diff --git a/src/peerconnection.cpp b/src/peerconnection.cpp index 3dc9f1a..4ced150 100644 --- a/src/peerconnection.cpp +++ b/src/peerconnection.cpp @@ -667,6 +667,8 @@ void PeerConnection::forwardMessage(message_ptr message) { stream); channel->onOpen(weak_bind(&PeerConnection::triggerDataChannel, this, weak_ptr{channel})); + + std::unique_lock lock(mDataChannelsMutex); // we are going to emplace mDataChannels.emplace(stream, channel); } else { // Invalid, close the DataChannel