mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 12:57:31 +02:00
Squelch harmless not_connected errors
This commit is contained in:
@ -8,6 +8,7 @@ Version 62:
|
|||||||
* Clear the error faster
|
* Clear the error faster
|
||||||
* Avoid explicit operator bool for error
|
* Avoid explicit operator bool for error
|
||||||
* Add http::is_fields trait
|
* Add http::is_fields trait
|
||||||
|
* Squelch harmless not_connected errors
|
||||||
|
|
||||||
API Changes:
|
API Changes:
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ int main()
|
|||||||
// Shut down SSL on the stream
|
// Shut down SSL on the stream
|
||||||
stream.shutdown(ec);
|
stream.shutdown(ec);
|
||||||
if(ec && ec != boost::asio::error::eof)
|
if(ec && ec != boost::asio::error::eof)
|
||||||
fail("ssl shutdown ", ec);
|
fail("ssl_shutdown ", ec);
|
||||||
|
|
||||||
// If we get here then the connection is closed gracefully
|
// If we get here then the connection is closed gracefully
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
@ -78,7 +78,11 @@ int main()
|
|||||||
|
|
||||||
// Gracefully close the socket
|
// Gracefully close the socket
|
||||||
sock.shutdown(tcp::socket::shutdown_both, ec);
|
sock.shutdown(tcp::socket::shutdown_both, ec);
|
||||||
if(ec)
|
|
||||||
|
// not_connected happens sometimes
|
||||||
|
// so don't bother reporting it.
|
||||||
|
//
|
||||||
|
if(ec && ec != beast::errc::not_connected)
|
||||||
return fail("shutdown", ec);
|
return fail("shutdown", ec);
|
||||||
|
|
||||||
// If we get here then the connection is closed gracefully
|
// If we get here then the connection is closed gracefully
|
||||||
|
@ -100,7 +100,7 @@ main(int, char const*[])
|
|||||||
// "half-close" here to shut down our end.
|
// "half-close" here to shut down our end.
|
||||||
//
|
//
|
||||||
sock.shutdown(tcp::socket::shutdown_send, ec);
|
sock.shutdown(tcp::socket::shutdown_send, ec);
|
||||||
if(ec)
|
if(ec && ec != beast::errc::not_connected)
|
||||||
return fail("shutdown", ec);
|
return fail("shutdown", ec);
|
||||||
}
|
}
|
||||||
if(ec)
|
if(ec)
|
||||||
@ -134,7 +134,7 @@ main(int, char const*[])
|
|||||||
// Now we do the other half of the close,
|
// Now we do the other half of the close,
|
||||||
// which is to shut down the receiver.
|
// which is to shut down the receiver.
|
||||||
sock.shutdown(tcp::socket::shutdown_receive, ec);
|
sock.shutdown(tcp::socket::shutdown_receive, ec);
|
||||||
if(ec)
|
if(ec && ec != beast::errc::not_connected)
|
||||||
return fail("shutdown", ec);
|
return fail("shutdown", ec);
|
||||||
|
|
||||||
std::cout << res << std::endl;
|
std::cout << res << std::endl;
|
||||||
|
@ -560,7 +560,11 @@ private:
|
|||||||
{
|
{
|
||||||
error_code ec;
|
error_code ec;
|
||||||
stream().shutdown(socket_type::shutdown_both, ec);
|
stream().shutdown(socket_type::shutdown_both, ec);
|
||||||
if(ec)
|
|
||||||
|
// not_connected happens under normal
|
||||||
|
// circumstances so don't bother reporting it.
|
||||||
|
//
|
||||||
|
if(ec && ec != beast::errc::not_connected)
|
||||||
return this->fail("shutdown", ec);
|
return this->fail("shutdown", ec);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -198,7 +198,7 @@ private:
|
|||||||
{
|
{
|
||||||
// Give the derived class a chance to do stuff
|
// Give the derived class a chance to do stuff
|
||||||
impl().do_shutdown(ec);
|
impl().do_shutdown(ec);
|
||||||
if(ec)
|
if(ec && ec != beast::errc::not_connected)
|
||||||
return fail("shutdown", ec);
|
return fail("shutdown", ec);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ private:
|
|||||||
{
|
{
|
||||||
// Give the derived class a chance to do stuff
|
// Give the derived class a chance to do stuff
|
||||||
impl().do_shutdown(ec);
|
impl().do_shutdown(ec);
|
||||||
if(ec)
|
if(ec && ec != beast::errc::not_connected)
|
||||||
return fail("shutdown", ec);
|
return fail("shutdown", ec);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ private:
|
|||||||
{
|
{
|
||||||
// Give the derived class a chance to do stuff
|
// Give the derived class a chance to do stuff
|
||||||
impl().do_shutdown(ec);
|
impl().do_shutdown(ec);
|
||||||
if(ec)
|
if(ec && ec != beast::errc::not_connected)
|
||||||
return fail("shutdown", ec);
|
return fail("shutdown", ec);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ private:
|
|||||||
if(ec == beast::http::error::end_of_stream)
|
if(ec == beast::http::error::end_of_stream)
|
||||||
{
|
{
|
||||||
// Give the derived class a chance to do stuff
|
// Give the derived class a chance to do stuff
|
||||||
impl().do_shutdown(ec);
|
if(ec && ec != beast::errc::not_connected)
|
||||||
if(ec)
|
if(ec)
|
||||||
return fail("shutdown", ec);
|
return fail("shutdown", ec);
|
||||||
return;
|
return;
|
||||||
|
@ -93,7 +93,7 @@ private:
|
|||||||
//
|
//
|
||||||
stream().shutdown(ec);
|
stream().shutdown(ec);
|
||||||
if(ec)
|
if(ec)
|
||||||
return this->fail("shutdown", ec);
|
return this->fail("ssl_shutdown", ec);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -177,9 +177,10 @@ private:
|
|||||||
socket_type::shutdown_both,
|
socket_type::shutdown_both,
|
||||||
ec);
|
ec);
|
||||||
|
|
||||||
// Report failure if any
|
// not_connected happens under normal
|
||||||
|
// circumstances so don't bother reporting it.
|
||||||
//
|
//
|
||||||
if(ec)
|
if(ec && ec != beast::errc::not_connected)
|
||||||
return this->fail("shutdown", ec);
|
return this->fail("shutdown", ec);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user