void TcpAsyncServer::handle_accept(std::shared_ptr<TcpAsyncStream> connection, const boost::system::error_code& error) { if (!error) { connection->setAsConnected(); if (acceptCallback) acceptCallback(connection); startListening(); } else TCP_LOG("accept: " << error.message()) }
/** * Test passing contexts between threads */ TEST(AsyncSSLSocketTest2, AttachDetachSSLContext) { // Start listening on a local port WriteCallbackBase writeCallback; ReadCallback readCallback(&writeCallback); HandshakeCallback handshakeCallback(&readCallback); SSLServerAcceptCallbackDelay acceptCallback(&handshakeCallback); TestSSLServer server(&acceptCallback); EventBase eventBase; EventBaseAborter eba(&eventBase, 3000); std::shared_ptr<AttachDetachClient> client( new AttachDetachClient(&eventBase, server.getAddress())); client->connect(); eventBase.loop(); }
void MSListener::acceptNotify(int rfd,const struct sockaddr *rn,int rlen,const struct sockaddr *ln,int llen) { if (acceptCallback()!=0) (*acceptCallback())(rfd,rn,rlen,ln,llen,acceptCallbackData()); }