/// <summary> /// Handle_accepts the specified error. /// </summary> /// <param name="error">The error.</param> /// <param name="conn">The conn.</param> void TcpServer::handle_accept( const boost::system::error_code& error, const TcpConnectionPtr conn) { if (!error) /// ´¦Àí¼àÌýʼþ { conn->SetMessageCallBack(messageCallBack_); conn->SetErrorCallBack(errorCallBack_); conn->SetWriteCompleteCallBack(writecompleteCallBack_); if (acceptedCallBack_) { acceptedCallBack_(conn); } boost::weak_ptr<WheelEntry<TcpConnection> > weak_ptr = timing_wheel_.Register(conn, TimeOutCallBackT<TcpConnection>(boost::bind(&TcpServer::handle_timeout, this, _1))); conn->SetContent(boost::any(weak_ptr)); conn->Start(); TcpConnectionPtr tcpconnPtr(new TcpConnection(ioservicepool_.get_io_service(), messageCallBack_, &timing_wheel_)); acceptor_.async_accept(tcpconnPtr->socket(), boost::bind(&TcpServer::handle_accept, this, boost::asio::placeholders::error,tcpconnPtr)); } else { if (errorCallBack_) { errorCallBack_(conn, error); } } }