21 lines
427 B
C++
21 lines
427 B
C++
#define ASIO_STANDALONE
|
|
|
|
#include "server.hpp"
|
|
|
|
#include <memory>
|
|
|
|
void Server::do_accept()
|
|
{
|
|
m_acceptor.async_accept(m_socket,
|
|
[this](std::error_code ec)
|
|
{
|
|
if (!ec)
|
|
{
|
|
auto s = std::make_shared<Session>(std::move(m_socket),state);
|
|
m_sessions.push_back(s);
|
|
s->start();
|
|
}
|
|
|
|
do_accept();
|
|
});
|
|
}
|