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
56
56
}
57
57
58
58
FuzzedSock::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 ()}
60
62
{
61
- m_socket = fuzzed_data_provider.ConsumeIntegralInRange <SOCKET>(INVALID_SOCKET - 1 , INVALID_SOCKET);
62
63
}
63
64
64
65
FuzzedSock::~FuzzedSock ()
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(move_assignment)
60
60
{
61
61
const SOCKET s = CreateSocket ();
62
62
Sock* sock1 = new Sock (s);
63
- Sock* sock2 = new Sock ();
63
+ Sock* sock2 = new Sock (INVALID_SOCKET );
64
64
*sock2 = std::move (*sock1);
65
65
delete sock1;
66
66
BOOST_CHECK (!SocketIsClosed (s));
@@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(send_and_receive)
98
98
SendAndRecvMessage (*sock0, *sock1);
99
99
100
100
Sock* sock0moved = new Sock (std::move (*sock0));
101
- Sock* sock1moved = new Sock ();
101
+ Sock* sock1moved = new Sock (INVALID_SOCKET );
102
102
*sock1moved = std::move (*sock1);
103
103
104
104
delete sock0;
Original file line number Diff line number Diff line change @@ -106,10 +106,10 @@ constexpr auto ALL_NETWORKS = std::array{
106
106
class StaticContentsSock : public Sock
107
107
{
108
108
public:
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}
110
112
{
111
- // Just a dummy number that is not INVALID_SOCKET.
112
- m_socket = INVALID_SOCKET - 1 ;
113
113
}
114
114
115
115
~StaticContentsSock () override { m_socket = INVALID_SOCKET; }
@@ -192,6 +192,11 @@ class StaticContentsSock : public Sock
192
192
return true ;
193
193
}
194
194
195
+ bool IsConnected (std::string&) const override
196
+ {
197
+ return true ;
198
+ }
199
+
195
200
private:
196
201
const std::string m_contents;
197
202
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)
24
24
return err != WSAEAGAIN && err != WSAEINTR && err != WSAEWOULDBLOCK && err != WSAEINPROGRESS;
25
25
}
26
26
27
- Sock::Sock () : m_socket(INVALID_SOCKET) {}
28
-
29
27
Sock::Sock (SOCKET s) : m_socket(s) {}
30
28
31
29
Sock::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;
26
26
class Sock
27
27
{
28
28
public:
29
- /* *
30
- * Default constructor, creates an empty object that does nothing when destroyed.
31
- */
32
- Sock ();
29
+ Sock () = delete ;
33
30
34
31
/* *
35
32
* Take ownership of an existent socket.
You can’t perform that action at this time.
0 commit comments