| 387 | } |
| 388 | |
| 389 | void |
| 390 | on_read(beast::error_code ec, std::size_t bytes_transferred) |
| 391 | { |
| 392 | boost::ignore_unused(bytes_transferred); |
| 393 | |
| 394 | // This means they closed the connection |
| 395 | if(ec == http::error::end_of_stream) |
| 396 | return do_close(); |
| 397 | |
| 398 | if(ec) |
| 399 | return fail(ec, "read"); |
| 400 | |
| 401 | // See if it is a WebSocket Upgrade |
| 402 | if(websocket::is_upgrade(parser_->get())) |
| 403 | { |
| 404 | // Create a websocket session, transferring ownership |
| 405 | // of both the socket and the HTTP request. |
| 406 | std::make_shared<websocket_session>( |
| 407 | stream_.release_socket())->do_accept(parser_->release()); |
| 408 | return; |
| 409 | } |
| 410 | |
| 411 | // Send the response |
| 412 | queue_write(handle_request(*doc_root_, parser_->release())); |
| 413 | |
| 414 | // If we aren't at the queue limit, try to pipeline another request |
| 415 | if (response_queue_.size() < queue_limit) |
| 416 | do_read(); |
| 417 | } |
| 418 | |
| 419 | void |
| 420 | queue_write(http::message_generator response) |
nothing calls this directly
no test coverage detected