void on_connect(boost::asio::ip::tcp::socket &socket) { SNOW_LOG_TRACE("new Connection socket fd {}, local addr {}, peer addr {}", socket.native(), socket.local_endpoint(), socket.remote_endpoint()); std::make_shared<Connection>(socket, m_request_dispatcher, m_pkg_spliter, 100 * 1000)->start(); }
/** Check that local endpoint is loopback * * @throws Face::Error if validation failed */ static void validateSocket(boost::asio::ip::tcp::socket& socket) { if (!socket.local_endpoint().address().is_loopback() || !socket.remote_endpoint().address().is_loopback()) { throw Face::Error("TcpLocalFace can be created only on loopback interface"); } }