From 6fc8c588ff6d5d1a6124282a16481f8e98faa215 Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Fri, 13 Jan 2012 08:15:58 -0600 Subject: [PATCH] calling close while a connection is connecting will now abort the connection --- src/connection.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/connection.hpp b/src/connection.hpp index 91057b4ec0..ce50105583 100644 --- a/src/connection.hpp +++ b/src/connection.hpp @@ -154,10 +154,13 @@ public: write_message(msg); } - + // TODO: overloads without code or reason? void close(close::status::value code, const std::string& reason = "") { - // TODO: overloads without code or reason? - send_close(code, reason); + if (m_state == session::state::CONNECTING) { + terminate(true); + } else { + send_close(code, reason); + } } void ping(const std::string& payload) { send_ping(payload);