void Server::accept() { Session::ptr newSession = Session::create(m_acceptor.get_io_service(), this->m_cfg); boost::shared_ptr<protocol::Demuxer> demuxer(new protocol::Demuxer(newSession)); newSession->setDemuxer(demuxer); m_acceptor.async_accept(newSession->socket(), boost::bind(&Server::acceptHandler, this, newSession, boost::asio::placeholders::error)); }
void Server::accept() { for (;;) { Session::ptr newSession = Session::create(m_acceptor.get_io_service(), this->m_cfg); boost::shared_ptr<protocol::Demuxer> demuxer(new protocol::Demuxer(newSession)); newSession->setDemuxer(demuxer); m_acceptor.accept(newSession->socket()); boost::thread t(boost::bind(&Session::start, newSession)); } }
void BasicService::do_async_accept() { Session::ptr sp = new Session(service); srv_acceptor.async_accept(sp->socket(), boost::bind(&BasicService::handle_accept, this, _1, sp)); }