MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ThreadSocketHandler

Method ThreadSocketHandler

src/httpserver.cpp:958–982  ·  view source on GitHub ↗

\anchor http

Source from the content-addressed store, hash-verified

956
957/// \anchor http
958void HTTPServer::ThreadSocketHandler()
959{
960 while (!m_interrupt_net) {
961 // Check for the readiness of the already connected sockets and the
962 // listening sockets in one call ("readiness" as in poll(2) or
963 // select(2)). If none are ready, wait for a short while and return
964 // empty sets.
965 auto io_readiness{GenerateWaitSockets()};
966 if (io_readiness.events_per_sock.empty() ||
967 // WaitMany() may as well be a static method, the context of the first Sock in the vector is not relevant.
968 !io_readiness.events_per_sock.begin()->first->WaitMany(SELECT_TIMEOUT,
969 io_readiness.events_per_sock)) {
970 m_interrupt_net.sleep_for(SELECT_TIMEOUT);
971 }
972
973 // Service (send/receive) each of the already connected sockets.
974 SocketHandlerConnected(io_readiness);
975
976 // Accept new connections from listening sockets.
977 SocketHandlerListening(io_readiness.events_per_sock);
978
979 // Disconnect any clients that have been flagged.
980 DisconnectClients();
981 }
982}
983
984void HTTPServer::MaybeDispatchRequestsFromClient(const std::shared_ptr<HTTPRemoteClient>& client) const
985{

Callers

nothing calls this directly

Calls 4

emptyMethod · 0.45
WaitManyMethod · 0.45
beginMethod · 0.45
sleep_forMethod · 0.45

Tested by

no test coverage detected