void process(){ _handler->process( _cur , this ); if (_reply.data){ async_write( _socket , buffer( (char*)_reply.data , _reply.data->len ) , boost::bind( &MessageServerSession::handleWriteDone , shared_from_this() , boost::asio::placeholders::error ) ); } else { _cur.reset(); _startHeaderRead(); } }
void handleWriteDone( const boost::system::error_code& error ) { { // return thread to pool after we have sent data to the client mongo::mutex::scoped_lock(tp_mutex); verify(_myThread); thread_pool.push_back(_myThread); _myThread.reset(); } _cur.reset(); _reply.reset(); _startHeaderRead(); }
void handleWriteDone( const boost::system::error_code& error ){ _cur.reset(); _reply.reset(); _startHeaderRead(); }
void start(){ cout << "MessageServerSession start from:" << _socket.remote_endpoint() << endl; _startHeaderRead(); }