MCPcopy Create free account
hub / github.com/ElementsProject/elements / SocketIsClosed

Function SocketIsClosed

src/test/sock_tests.cpp:20–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18BOOST_FIXTURE_TEST_SUITE(sock_tests, BasicTestingSetup)
19
20static bool SocketIsClosed(const SOCKET& s)
21{
22 // Notice that if another thread is running and creates its own socket after `s` has been
23 // closed, it may be assigned the same file descriptor number. In this case, our test will
24 // wrongly pretend that the socket is not closed.
25 int type;
26 socklen_t len = sizeof(type);
27 return getsockopt(s, SOL_SOCKET, SO_TYPE, (sockopt_arg_type)&type, &len) == SOCKET_ERROR;
28}
29
30static SOCKET CreateSocket()
31{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected