| 161 | |
| 162 | private: |
| 163 | void DoAccept() |
| 164 | { |
| 165 | // The new connection gets its own strand |
| 166 | acceptor.async_accept(boost::asio::make_strand(io_context), |
| 167 | [weak_self = std::weak_ptr<Server>(shared_from_this())]( |
| 168 | boost::beast::error_code ec, boost::asio::ip::tcp::socket socket) |
| 169 | { |
| 170 | if (auto self = weak_self.lock()) |
| 171 | { |
| 172 | self->OnAccept(ec, std::move(socket)); |
| 173 | } |
| 174 | }); |
| 175 | } |
| 176 | |
| 177 | void OnAccept(boost::beast::error_code ec, boost::asio::ip::tcp::socket socket) |
| 178 | { |