コード例 #1
0
ファイル: TcpAsyncServer.cpp プロジェクト: RazielXT/mtTorrent
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())
}
コード例 #2
0
/**
 * 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();
}
コード例 #3
0
ファイル: MSListener.C プロジェクト: PlanetAPL/a-plus
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());
}