MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / acceptConnection

Method acceptConnection

base/poco/Net/src/SocketImpl.cpp:79–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77
78
79SocketImpl* SocketImpl::acceptConnection(SocketAddress& clientAddr)
80{
81 if (_sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException();
82
83 sockaddr_storage buffer;
84 struct sockaddr* pSA = reinterpret_cast<struct sockaddr*>(&buffer);
85 poco_socklen_t saLen = sizeof(buffer);
86 poco_socket_t sd;
87 do
88 {
89 sd = ::accept(_sockfd, pSA, &saLen);
90 }
91 while (sd == POCO_INVALID_SOCKET && lastError() == POCO_EINTR);
92 if (sd != POCO_INVALID_SOCKET)
93 {
94 clientAddr = SocketAddress(pSA, saLen);
95 return new StreamSocketImpl(sd);
96 }
97 error(); // will throw
98 return 0;
99}
100
101
102void SocketImpl::connect(const SocketAddress& address)

Callers 8

runMethod · 0.45
onAcceptMethod · 0.45
onAcceptMethod · 0.45
TYPED_TESTFunction · 0.45
runMethod · 0.45
TESTFunction · 0.45
makeConnectedPairFunction · 0.45
TESTFunction · 0.45

Calls 2

errorFunction · 0.85
SocketAddressClass · 0.50

Tested by 4

TYPED_TESTFunction · 0.36
TESTFunction · 0.36
makeConnectedPairFunction · 0.36
TESTFunction · 0.36