diff --git a/changelog.md b/changelog.md index 890b73f0bf..628b326fb0 100644 --- a/changelog.md +++ b/changelog.md @@ -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 diff --git a/websocketpp/transport/asio/connection.hpp b/websocketpp/transport/asio/connection.hpp index b7ed706a5b..42defb6bce 100644 --- a/websocketpp/transport/asio/connection.hpp +++ b/websocketpp/transport/asio/connection.hpp @@ -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,