Suppress error when shutting down a closed connection

This commit is contained in:
Peter Thorson
2013-07-17 07:28:26 -05:00
parent c6f579a52a
commit 241cf697f6
2 changed files with 10 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
HEAD
- Suppress error when trying to shut down a connection that was already closed
0.3.0-alpha3 - 2013-07-16
- Minor refactor to bundled sha1 library

View File

@@ -852,7 +852,15 @@ protected:
if (ec) {
log_err(log::elevel::info,"asio async_shutdown",ec);
callback(make_error_code(transport::error::pass_through));
if (ec == boost::asio::error::not_connected) {
// The socket was already closed when we tried to close it. This
// happens periodically (usually if a read or write fails
// earlier and if it is a real error will be caught at another
// level of the stack.
callback(lib::error_code());
} else {
callback(make_error_code(transport::error::pass_through));
}
} else {
if (m_alog.static_test(log::alevel::devel)) {
m_alog.write(log::alevel::devel,