Bug 1521304: Move some Mutexes r=tuexen,dminor
authorRandell Jesup <rjesup@jesup.org>
Tue, 12 Feb 2019 07:28:27 -0500
changeset 458731 9f93017d5be057df482f938b4cff7872208214f1
parent 458730 636d2c00234df8e0d8fb3a058dba9dda0ccd1772
child 458732 ea8190021659c7b40fe5e91865ea0f6a0a0bbd1d
push id111890
push userrjesup@wgate.com
push dateWed, 13 Feb 2019 05:00:11 +0000
treeherdermozilla-inbound@9f93017d5be0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstuexen, dminor
bugs1521304
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1521304: Move some Mutexes r=tuexen,dminor
netwerk/sctp/datachannel/DataChannel.cpp
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -2308,22 +2308,31 @@ void DataChannelConnection::HandleNotifi
 int DataChannelConnection::ReceiveCallback(struct socket *sock, void *data,
                                            size_t datalen,
                                            struct sctp_rcvinfo rcv, int flags) {
   ASSERT_WEBRTC(!NS_IsMainThread());
 
   if (!data) {
     LOG(("ReceiveCallback: 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, flags);
     }
+    if (locked) {
+      mLock.Unlock();
+    }
   }
   // sctp allocates 'data' with malloc(), and expects the receiver to free
   // it (presumably with free).
   // XXX future optimization: try to deliver messages without an internal
   // alloc/copy, and if so delay the free until later.
   free(data);
   // usrsctp defines the callback as returning an int, but doesn't use it
   return 1;