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));
   }
 }
Esempio n. 2
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));
		}
	}
Esempio n. 3
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();
}