Skip to content

Commit

Permalink
修复 SSL 连接异常关闭问题
Browse files Browse the repository at this point in the history
  • Loading branch information
lanthora committed May 15, 2024
1 parent 3849b32 commit 6d0cc7f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.18.4)

project(candy LANGUAGES C CXX VERSION 5.8.3)
project(candy LANGUAGES C CXX VERSION 5.8.4)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wfatal-errors")

Expand Down
14 changes: 9 additions & 5 deletions src/websocket/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@ int WebSocketClient::connect(const std::string &address) {
}

int WebSocketClient::disconnect() {
this->pollSet.clear();
if (this->ws) {
this->ws->shutdown();
this->ws->close();
this->ws.reset();
try {
this->pollSet.clear();
if (this->ws) {
this->ws->shutdown();
this->ws->close();
this->ws.reset();
}
} catch (std::exception &e) {
spdlog::debug("websocket disconnect failed: {}", e.what());
}
return 0;
}
Expand Down

0 comments on commit 6d0cc7f

Please sign in to comment.