| 175 | } |
| 176 | |
| 177 | void OnAccept(boost::beast::error_code ec, boost::asio::ip::tcp::socket socket) |
| 178 | { |
| 179 | if (!ec) |
| 180 | { |
| 181 | // Create the connection and start it |
| 182 | auto connection = std::make_shared<Connection>( |
| 183 | std::move(socket), request_handler, max_header_size, keepalive_timeout); |
| 184 | |
| 185 | connection->start(); |
| 186 | } |
| 187 | else if (ec != boost::asio::error::operation_aborted) |
| 188 | { |
| 189 | util::Log(logERROR) << "Accept error: " << ec.message(); |
| 190 | } |
| 191 | |
| 192 | // Accept another connection |
| 193 | if (acceptor.is_open()) |
| 194 | { |
| 195 | DoAccept(); |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | RequestHandler request_handler; |
| 200 | unsigned thread_pool_size; |