Esempio n. 1
0
		//---------------------------------------------------------------------
		void World::OnConnection(Network::Connection::pointer pConnection)
		{
			Session::pointer session = boost::make_shared<Session>(pConnection, this, ++mId);

			mGuard.lock();
			mSessions.push_back(session);
			mGuard.unlock();

			session->Start();
		}
Esempio n. 2
0
    void handle_accept(session::pointer session, boost::system::error_code const &error)
    {
        if (error) return;

        session->start();
        start_accept();
    }
Esempio n. 3
0
void server::handle_accept(session::pointer new_session, const boost::system::error_code& error)
{
	if (!error)
	{
        // Check whether the server was stopped by a signal before this
        // completion handler had a chance to run.
        if (!acceptor_.is_open())
        {
            return;
        }

        new_session->start();
        new_session = make_session();

        auto accept_callback = boost::bind(&server::handle_accept, this, new_session, boost::asio::placeholders::error);
        acceptor_.async_accept(new_session->get_socket(), accept_callback);
	}
}
Esempio n. 4
0
void server::accept(session::pointer new_session,
        const boost::system::error_code& error)
{
    if (!error)
    {
        new_session->start();
        listen();
    }
}