diff --git a/websocketpp/impl/connection_impl.hpp b/websocketpp/impl/connection_impl.hpp index 1640dfd37b..c79c4b6dec 100644 --- a/websocketpp/impl/connection_impl.hpp +++ b/websocketpp/impl/connection_impl.hpp @@ -1013,11 +1013,13 @@ void connection::terminate() { if (m_fail_handler) { m_fail_handler(m_connection_hdl); } - } else { + } else if (m_state != session::state::CLOSED) { m_state = session::state::CLOSED; if (m_close_handler) { m_close_handler(m_connection_hdl); } + } else { + m_alog.write(log::alevel::devel,"terminate called on connection that was already terminated"); } // call the termination handler if it exists