示例#1
0
void Connection::handle_accept(session_ptr session, const boost::system::error_code& error)
{
	if (!error)
	{
		session->start();
		session_ptr new_session(new Session(io_service_, room_));
		acceptor_.async_accept(new_session->socket(), boost::bind(&Connection::handle_accept, this, new_session, boost::asio::placeholders::error));
	}
}
 void handle_accept(session_ptr new_session,
     const asio::error_code& error)
 {
   if (!error)
   {
     new_session->start();
     new_session.reset(new session(io_service_));
     acceptor_.async_accept(new_session->socket(),
         boost::bind(&server::handle_accept, this, new_session,
           asio::placeholders::error));
   }
 }
示例#3
0
	void handle_accept(session_ptr new_session,
		const boost::system::error_code& error)
	{
		if (!error)
		{
			new_session->start();
			new_session.reset(new session(io_service_work_pool_.get_io_service(), io_service_pool_.get_io_service()));
			acceptor_.async_accept(new_session->socket(),
				boost::bind(&server::handle_accept, this, new_session,
				boost::asio::placeholders::error));
		}
	}
示例#4
0
	  void handle_accept(session_ptr new_session,
		  const boost::system::error_code& error)
	  {
		  if(!error)
		  {
			  cout << "accept connection ..." << endl;
			  new_session->start();
			  do_accept();
		  }
		  else
		  {
			  delete new_session;
		  }
	  }
示例#5
0
 void handle_accept(session_ptr new_session,
                    const boost::system::error_code & error)
 {
     if (!error)
     {
         std::cout << "New connection accepted" << std::endl;
         new_session->start();
         start_accept();
     }
     else if (error != boost::asio::error::operation_aborted)
     {
         // 'operation_aborted' error occurs on server stoppage
         handle_error(error);
     }
 }
示例#6
0
void server::handle_accept(session_ptr new_session,
		const boost::system::error_code& error)
{
		if (!error)
		{
			{
				boost::mutex::scoped_lock lock(sessionsLock_);
				sessions_.push_back(new_session);

				session_ptr new_session(new session(io_service_, this, maxLength_));
				acceptor_.async_accept(new_session->socket(),
								boost::bind(&server::handle_accept, this, new_session,
										boost::asio::placeholders::error));
			}
			new_session->start();
		}
		start_accept();
}