From 6d0cc7f7a50f77a078fca4d0b668be2447e3f443 Mon Sep 17 00:00:00 2001 From: lanthora Date: Wed, 15 May 2024 06:33:25 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20SSL=20=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=85=B3=E9=97=AD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 +- src/websocket/client.cc | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e3241bd..4b0de88d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/src/websocket/client.cc b/src/websocket/client.cc index f1864bdf..ee4ccc72 100644 --- a/src/websocket/client.cc +++ b/src/websocket/client.cc @@ -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; }