MCPcopy Create free account
hub / github.com/boostorg/asio / do_accept

Method do_accept

example/cpp11/http/server3/server.cpp:63–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63void server::do_accept()
64{
65 // The newly accepted socket is put into its own strand to ensure that all
66 // completion handlers associated with the connection do not run concurrently.
67 acceptor_.async_accept(boost::asio::make_strand(io_context_),
68 [this](boost::system::error_code ec, boost::asio::ip::tcp::socket socket)
69 {
70 // Check whether the server was stopped by a signal before this
71 // completion handler had a chance to run.
72 if (!acceptor_.is_open())
73 {
74 return;
75 }
76
77 if (!ec)
78 {
79 std::make_shared<connection>(
80 std::move(socket), request_handler_)->start();
81 }
82
83 do_accept();
84 });
85}
86
87void server::do_await_stop()
88{

Callers

nothing calls this directly

Calls 4

make_strandFunction · 0.85
async_acceptMethod · 0.45
is_openMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected