File tree Expand file tree Collapse file tree 5 files changed +14
-13
lines changed Expand file tree Collapse file tree 5 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -56,9 +56,10 @@ CAddress ConsumeAddress(FuzzedDataProvider& fuzzed_data_provider) noexcept
5656}
5757
5858FuzzedSock::FuzzedSock (FuzzedDataProvider& fuzzed_data_provider)
59- : m_fuzzed_data_provider{fuzzed_data_provider}, m_selectable{fuzzed_data_provider.ConsumeBool ()}
59+ : Sock{fuzzed_data_provider.ConsumeIntegralInRange <SOCKET>(INVALID_SOCKET - 1 , INVALID_SOCKET)},
60+ m_fuzzed_data_provider{fuzzed_data_provider},
61+ m_selectable{fuzzed_data_provider.ConsumeBool ()}
6062{
61- m_socket = fuzzed_data_provider.ConsumeIntegralInRange <SOCKET>(INVALID_SOCKET - 1 , INVALID_SOCKET);
6263}
6364
6465FuzzedSock::~FuzzedSock ()
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(move_assignment)
6060{
6161 const SOCKET s = CreateSocket ();
6262 Sock* sock1 = new Sock (s);
63- Sock* sock2 = new Sock ();
63+ Sock* sock2 = new Sock (INVALID_SOCKET );
6464 *sock2 = std::move (*sock1);
6565 delete sock1;
6666 BOOST_CHECK (!SocketIsClosed (s));
@@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(send_and_receive)
9898 SendAndRecvMessage (*sock0, *sock1);
9999
100100 Sock* sock0moved = new Sock (std::move (*sock0));
101- Sock* sock1moved = new Sock ();
101+ Sock* sock1moved = new Sock (INVALID_SOCKET );
102102 *sock1moved = std::move (*sock1);
103103
104104 delete sock0;
Original file line number Diff line number Diff line change @@ -106,10 +106,10 @@ constexpr auto ALL_NETWORKS = std::array{
106106class StaticContentsSock : public Sock
107107{
108108public:
109- explicit StaticContentsSock (const std::string& contents) : m_contents{contents}
109+ explicit StaticContentsSock (const std::string& contents)
110+ : Sock{INVALID_SOCKET},
111+ m_contents{contents}
110112 {
111- // Just a dummy number that is not INVALID_SOCKET.
112- m_socket = INVALID_SOCKET - 1 ;
113113 }
114114
115115 ~StaticContentsSock () override { m_socket = INVALID_SOCKET; }
@@ -192,6 +192,11 @@ class StaticContentsSock : public Sock
192192 return true ;
193193 }
194194
195+ bool IsConnected (std::string&) const override
196+ {
197+ return true ;
198+ }
199+
195200private:
196201 const std::string m_contents;
197202 mutable size_t m_consumed{0 };
Original file line number Diff line number Diff line change @@ -24,8 +24,6 @@ static inline bool IOErrorIsPermanent(int err)
2424 return err != WSAEAGAIN && err != WSAEINTR && err != WSAEWOULDBLOCK && err != WSAEINPROGRESS;
2525}
2626
27- Sock::Sock () : m_socket(INVALID_SOCKET) {}
28-
2927Sock::Sock (SOCKET s) : m_socket(s) {}
3028
3129Sock::Sock (Sock&& other)
Original file line number Diff line number Diff line change @@ -26,10 +26,7 @@ static constexpr auto MAX_WAIT_FOR_IO = 1s;
2626class Sock
2727{
2828public:
29- /* *
30- * Default constructor, creates an empty object that does nothing when destroyed.
31- */
32- Sock ();
29+ Sock () = delete ;
3330
3431 /* *
3532 * Take ownership of an existent socket.
You can’t perform that action at this time.
0 commit comments