Skip to content

Commit cb18692

Browse files
author
Thomas
committed
fix potential deadlock
1 parent 8d8e62e commit cb18692

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sdk/src/signaling_device/src/signaling_device_impl.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,15 +167,17 @@ void SignalingDeviceImpl::close() {
167167
channel.second->wsClosed();
168168
channelClosed(channel.first);
169169
}
170+
nabto::webrtc::WebsocketConnectionPtr ws;
170171
{
171172
const std::lock_guard<std::mutex> lock(mutex_);
172173
channels_.clear();
173174

174-
if (ws_) {
175-
ws_->close();
176-
}
175+
ws = ws_;
176+
}
177+
if (ws) {
178+
ws->close();
177179
}
178-
if (!ws_) {
180+
if (!ws) {
179181
deinit();
180182
}
181183
}

0 commit comments

Comments
 (0)