GaiaTCP/Acceptor.cpp
/// Accept a request and establish a connection.
Accept a request and establish a connection.
Accept a request and establish a connection .
Connection Acceptor::Accept()
    {
        auto context = std::make_unique<boost::asio::io_context>();
        auto socket = boost::asio::ip::tcp::socket(*context);
        boost::asio::ip::tcp::acceptor acceptor(*context, BoundAddress);
        acceptor.accept(socket);
        return Connection(std::move(context), std::move(socket));
    }
Connection Acceptor :: Accept ( ) { auto context = std :: make_unique < boost :: asio :: io_context > ( ) ; auto socket = boost :: asio :: ip :: tcp :: socket ( * context ) ; boost :: asio :: ip :: tcp :: acceptor acceptor ( * context , BoundAddress ) ; acceptor . accept ( socket ) ; return Connection ( std :: move ( context ) , std :: move ( socket ) ) ; }
Accept a request and establish a connection.
Accept a request and establish a connection .
/*
         * The context is newly constructed here,
         * because IO objects of boost::asio in the same context will actually work in serial working model.
         */