From 081cece704081e314127f964c8f01338cc098db3 Mon Sep 17 00:00:00 2001 From: tnoho Date: Fri, 27 Sep 2024 18:59:59 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/sora/sora_signaling.h | 2 +- src/sora_signaling.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/sora/sora_signaling.h b/include/sora/sora_signaling.h index 192a395f..0afc7506 100644 --- a/include/sora/sora_signaling.h +++ b/include/sora/sora_signaling.h @@ -227,7 +227,7 @@ class SoraSignaling : public std::enable_shared_from_this, void SendOnSignalingMessage(SoraSignalingType type, SoraSignalingDirection direction, std::string message); - void SendOnWsClose(boost::beast::websocket::close_reason& reason); + void SendOnWsClose(const boost::beast::websocket::close_reason& reason); webrtc::DataBuffer ConvertToDataBuffer(const std::string& label, const std::string& input); diff --git a/src/sora_signaling.cpp b/src/sora_signaling.cpp index ca0cd4c9..398fa0fd 100644 --- a/src/sora_signaling.cpp +++ b/src/sora_signaling.cpp @@ -704,10 +704,10 @@ void SoraSignaling::DoInternalDisconnect( self->on_ws_close_ = [self, on_close](boost::system::error_code ec) { boost::system::error_code tec; self->closing_timeout_timer_.cancel(tec); + auto reason = self->ws_->reason(); + self->SendOnWsClose(reason); bool ec_error = ec != boost::beast::websocket::error::closed; if (ec_error) { - auto reason = self->ws_->reason(); - self->SendOnWsClose(reason); on_close(false, SoraSignalingErrorCode::CLOSE_FAILED, "Failed to close WebSocket: ec=" + ec.message() + " wscode=" + std::to_string(reason.code) + @@ -1360,9 +1360,9 @@ void SoraSignaling::SendOnSignalingMessage(SoraSignalingType type, } void SoraSignaling::SendOnWsClose( - boost::beast::websocket::close_reason& reason) { + const boost::beast::websocket::close_reason& reason) { if (auto ob = config_.observer.lock(); ob) { - ob->OnWsClose(reason.code, std::string(reason.reason.c_str())); + ob->OnWsClose(reason.code, reason.reason.c_str()); } }