| 808 | } |
| 809 | |
| 810 | void HTTPServer::NewSockAccepted(std::unique_ptr<Sock>&& sock, const CService& addr) |
| 811 | { |
| 812 | if (!sock->IsSelectable()) { |
| 813 | LogDebug(BCLog::HTTP, |
| 814 | "connection from %s dropped: non-selectable socket", |
| 815 | addr.ToStringAddrPort()); |
| 816 | return; |
| 817 | } |
| 818 | |
| 819 | // According to the internet TCP_NODELAY is not carried into accepted sockets |
| 820 | // on all platforms. Set it again here just to be sure. |
| 821 | if (sock->SetSockOpt(IPPROTO_TCP, TCP_NODELAY, &SOCKET_OPTION_TRUE, sizeof(SOCKET_OPTION_TRUE)) == SOCKET_ERROR) { |
| 822 | LogDebug(BCLog::HTTP, "connection from %s: unable to set TCP_NODELAY, continuing anyway", |
| 823 | addr.ToStringAddrPort()); |
| 824 | } |
| 825 | |
| 826 | const Id id{GetNewId()}; |
| 827 | |
| 828 | m_connected.push_back(std::make_shared<HTTPRemoteClient>(id, addr, std::move(sock))); |
| 829 | // Report back to the main thread |
| 830 | m_connected_size.fetch_add(1, std::memory_order_relaxed); |
| 831 | |
| 832 | LogDebug(BCLog::HTTP, |
| 833 | "HTTP Connection accepted from %s (id=%llu)", |
| 834 | addr.ToStringAddrPort(), id); |
| 835 | } |
| 836 | |
| 837 | void HTTPServer::SocketHandlerConnected(const IOReadiness& io_readiness) const |
| 838 | { |
nothing calls this directly
no test coverage detected