| 494 | } |
| 495 | |
| 496 | void |
| 497 | on_read(beast::error_code ec, std::size_t bytes_transferred) |
| 498 | { |
| 499 | boost::ignore_unused(bytes_transferred); |
| 500 | |
| 501 | // This means they closed the connection |
| 502 | if(ec == http::error::end_of_stream) |
| 503 | return derived().do_eof(); |
| 504 | |
| 505 | if(ec) |
| 506 | return fail(ec, "read"); |
| 507 | |
| 508 | // See if it is a WebSocket Upgrade |
| 509 | if(websocket::is_upgrade(parser_->get())) |
| 510 | { |
| 511 | // Disable the timeout. |
| 512 | // The websocket::stream uses its own timeout settings. |
| 513 | beast::get_lowest_layer(derived().stream()).expires_never(); |
| 514 | |
| 515 | // Create a websocket session, transferring ownership |
| 516 | // of both the socket and the HTTP request. |
| 517 | return make_websocket_session( |
| 518 | derived().release_stream(), |
| 519 | parser_->release()); |
| 520 | } |
| 521 | |
| 522 | // Send the response |
| 523 | queue_write(handle_request(*doc_root_, parser_->release())); |
| 524 | |
| 525 | // If we aren't at the queue limit, try to pipeline another request |
| 526 | if (response_queue_.size() < queue_limit) |
| 527 | do_read(); |
| 528 | } |
| 529 | |
| 530 | void |
| 531 | queue_write(http::message_generator response) |
nothing calls this directly
no test coverage detected