Skip to content

Commit

Permalink
OnWsClose を自分自身の時にも発火するようにする
Browse files Browse the repository at this point in the history
  • Loading branch information
tnoho committed Sep 28, 2024
1 parent 5151afb commit cfb0be7
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/sora_signaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ void SoraSignaling::Redirect(std::string url) {
}

auto on_close = [self, url](boost::system::error_code ec) {
if (!ec) {
self->SendOnWsClose(boost::beast::websocket::close_reason(
boost::beast::websocket::close_code::normal));
}

if (self->state_ != State::Redirecting) {
return;
}
Expand Down Expand Up @@ -1143,8 +1148,14 @@ void SoraSignaling::OnRead(boost::system::error_code ec,
auto it = m.as_object().find("ignore_disconnect_websocket");
if (it != m.as_object().end() && it->value().as_bool() && ws_connected_) {
RTC_LOG(LS_INFO) << "Close WebSocket for DataChannel";
ws_->Close([self = shared_from_this()](boost::system::error_code) {},
config_.websocket_close_timeout);
ws_->Close(
[self = shared_from_this()](boost::system::error_code ec) {
if (!ec) {
self->SendOnWsClose(boost::beast::websocket::close_reason(
boost::beast::websocket::close_code::normal));
}
},
config_.websocket_close_timeout);
ws_connected_ = false;

return;
Expand Down

0 comments on commit cfb0be7

Please sign in to comment.