We should check, is connections is still open and gracefully return on connection closed by remote.
This commit is contained in:
parent
145974bc92
commit
43f60bc69c
@ -68,7 +68,13 @@ void Connection::handle_read(const boost::system::error_code &error, std::size_t
|
|||||||
// the request has been parsed
|
// the request has been parsed
|
||||||
if (result == RequestParser::RequestStatus::valid)
|
if (result == RequestParser::RequestStatus::valid)
|
||||||
{
|
{
|
||||||
current_request.endpoint = TCP_socket.remote_endpoint().address();
|
|
||||||
|
boost::system::error_code ec;
|
||||||
|
current_request.endpoint = TCP_socket.remote_endpoint(ec).address();
|
||||||
|
if (ec) {
|
||||||
|
handle_shutdown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
request_handler.HandleRequest(current_request, current_reply);
|
request_handler.HandleRequest(current_request, current_reply);
|
||||||
|
|
||||||
if (boost::iequals(current_request.connection, "close"))
|
if (boost::iequals(current_request.connection, "close"))
|
||||||
@ -168,7 +174,8 @@ void Connection::handle_timeout(boost::system::error_code ec)
|
|||||||
// Absent next request during waiting time in the keepalive mode - should stop right there.
|
// Absent next request during waiting time in the keepalive mode - should stop right there.
|
||||||
if (ec != boost::asio::error::operation_aborted)
|
if (ec != boost::asio::error::operation_aborted)
|
||||||
{
|
{
|
||||||
TCP_socket.cancel();
|
boost::system::error_code ignore_error;
|
||||||
|
TCP_socket.cancel(ignore_error);
|
||||||
handle_shutdown();
|
handle_shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user