summaryrefslogtreecommitdiffstats
path: root/netwerk
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-03-23 13:26:20 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-03-23 13:26:20 +0100
commit9fc25801fdae8a88e2baa68bb500b24e53d9d8bf (patch)
treec75e1147fc325886f6681bc7c931f4bfa3841167 /netwerk
parent1709b8a59ceb96f350598699d0ae8326c0bf0778 (diff)
downloadUXP-9fc25801fdae8a88e2baa68bb500b24e53d9d8bf.tar
UXP-9fc25801fdae8a88e2baa68bb500b24e53d9d8bf.tar.gz
UXP-9fc25801fdae8a88e2baa68bb500b24e53d9d8bf.tar.lz
UXP-9fc25801fdae8a88e2baa68bb500b24e53d9d8bf.tar.xz
UXP-9fc25801fdae8a88e2baa68bb500b24e53d9d8bf.zip
WebRTC: Add explicit mutex on callback receiver for cases it's not
already locked.
Diffstat (limited to 'netwerk')
-rw-r--r--netwerk/sctp/datachannel/DataChannel.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/netwerk/sctp/datachannel/DataChannel.cpp b/netwerk/sctp/datachannel/DataChannel.cpp
index ebc430f8c..19be43d1c 100644
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -1928,12 +1928,21 @@ DataChannelConnection::ReceiveCallback(struct socket* sock, void *data, size_t d
if (!data) {
usrsctp_close(sock); // SCTP has finished shutting down
} else {
- mLock.AssertCurrentThreadOwns();
+ bool locked = false;
+ if (!IsSTSThread()) {
+ mLock.Lock();
+ locked = true;
+ } else {
+ mLock.AssertCurrentThreadOwns();
+ }
if (flags & MSG_NOTIFICATION) {
HandleNotification(static_cast<union sctp_notification *>(data), datalen);
} else {
HandleMessage(data, datalen, ntohl(rcv.rcv_ppid), rcv.rcv_sid);
}
+ if (locked) {
+ mLock.Unlock();
+ }
}
// sctp allocates 'data' with malloc(), and expects the receiver to free
// it (presumably with free).