void TcpServer::acceptedHandler(const TcpConnectionPtr& connection, const EventArgs& args) { debug_log("thread id = %d", std::this_thread::get_id()); //callbacks connection->registerDataWriteFinishedEvent(_dataWriteFinishedEvent); connection->registerDataReadEvent(_dataReadEvent); connection->registerConnectionClosedEvent(_connectionClosedEvent); if (_newConnectionEvent) { _newConnectionEvent(connection, NewConnectionEventArgs(connection->getPeerAddress())); } }