Skip to content

Commit

Permalink
fix: only websocket not closed then send close frame
Browse files Browse the repository at this point in the history
  • Loading branch information
helintongh committed Oct 13, 2023
1 parent 7a23d50 commit 64a81d8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/cinatra/connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 64a81d8

Please sign in to comment.