Browse Source

Fixed missing data channels mutex lock

Paul-Louis Ageneau 4 years ago
parent
commit
fe9a34905b
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/peerconnection.cpp

+ 2 - 0
src/peerconnection.cpp

@@ -667,6 +667,8 @@ void PeerConnection::forwardMessage(message_ptr message) {
 			                                                  stream);
 			channel->onOpen(weak_bind(&PeerConnection::triggerDataChannel, this,
 			                          weak_ptr<DataChannel>{channel}));
+
+			std::unique_lock lock(mDataChannelsMutex); // we are going to emplace
 			mDataChannels.emplace(stream, channel);
 		} else {
 			// Invalid, close the DataChannel