From 5ea7ee328e44fd7e333b15a18d26bfa42204b0cc Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Fri, 1 Feb 2013 07:50:13 -0600 Subject: [PATCH] adds state check to connection::close --- websocketpp/impl/connection_impl.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/websocketpp/impl/connection_impl.hpp b/websocketpp/impl/connection_impl.hpp index 0fbc410fac..6c97998cd2 100644 --- a/websocketpp/impl/connection_impl.hpp +++ b/websocketpp/impl/connection_impl.hpp @@ -214,6 +214,10 @@ void connection::close(const close::status::value code, { m_alog.write(log::alevel::devel,"connection close"); // check state + if (m_state != session::state::OPEN) { + ec = error::make_error_code(error::invalid_state); + return; + } // check reason length if (reason.size() > frame::limits::close_reason_size) {