From f5e70fdcf34b6abc003906367218c395be9248db Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Fri, 14 Dec 2012 09:55:52 -0800 Subject: [PATCH] Make sure the socket doesn't go away while we're shutting it down asynchronously. --- src/cpp/websocketpp/src/sockets/tls.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cpp/websocketpp/src/sockets/tls.hpp b/src/cpp/websocketpp/src/sockets/tls.hpp index c20d8a58e..156901a4e 100644 --- a/src/cpp/websocketpp/src/sockets/tls.hpp +++ b/src/cpp/websocketpp/src/sockets/tls.hpp @@ -52,7 +52,7 @@ public: return m_io_service; } - static void dummy_handler(const boost::system::error_code&) { + static void handle_shutdown(tls_socket_ptr, const boost::system::error_code&) { } // should be private friended? @@ -140,7 +140,13 @@ public: bool shutdown() { boost::system::error_code ignored_ec; - m_socket_ptr->async_shutdown(dummy_handler); // don't block on SSL shutdown DJS + m_socket_ptr->async_shutdown( // Don't block on connection shutdown DJS + boost::bind( + &tls::handle_shutdown, + m_socket_ptr, + boost::asio::placeholders::error + ) + ); if (ignored_ec) { return false;