From 64a81d8cb077bea437fcead10e8253b5b1136d51 Mon Sep 17 00:00:00 2001 From: helintongh Date: Fri, 13 Oct 2023 16:11:41 +0800 Subject: [PATCH] fix: only websocket not closed then send close frame --- include/cinatra/connection.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/cinatra/connection.hpp b/include/cinatra/connection.hpp index 49c3b64b..30bde678 100644 --- a/include/cinatra/connection.hpp +++ b/include/cinatra/connection.hpp @@ -686,7 +686,8 @@ class connection : public base_connection, return; } - if (req_.get_content_type() == content_type::websocket) { + if (req_.get_content_type() == content_type::websocket && + !req_.set_websocket_state()) { req_.set_websocket_state(true); std::string close_reason = "server close\n"; std::string close_msg = ws_.format_close_payload(