Bug 1521304: Move some Mutexes r=tuexen,dminor
☠☠ backed out by 47048ef82b50 ☠ ☠
authorRandell Jesup <rjesup@jesup.org>
Tue, 12 Feb 2019 07:28:27 -0500
changeset 458701 2161b075ce64
parent 458700 b3f7df7c7a53
child 458702 609114233603
push id35544
push userccoroiu@mozilla.com
push dateTue, 12 Feb 2019 16:29:08 +0000
treeherdermozilla-central@c849fb69e2e7 [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
@@ -260,16 +260,17 @@ static DataChannelConnection *GetConnect
 
   return connection;
 }
 
 // called when the buffer empties to the threshold value
 static int threshold_event(struct socket *sock, uint32_t sb_free) {
   DataChannelConnection *connection = GetConnectionFromSocket(sock);
   if (connection) {
+    MutexAutoLock lock(connection->mLock);
     connection->SendDeferredMessages();
   } else {
     LOG(("Can't find connection for socket %p", sock));
   }
   return 0;
 }
 
 static void debug_printf(const char *format, ...) {
@@ -836,17 +837,16 @@ void DataChannelConnection::SctpDtlsInpu
 
     if ((buf = usrsctp_dumppacket((void *)packet.data(), packet.len(),
                                   SCTP_DUMP_INBOUND)) != nullptr) {
       SCTP_LOG(("%s", buf));
       usrsctp_freedumpbuffer(buf);
     }
   }
   // Pass the data to SCTP
-  MutexAutoLock lock(mLock);
   usrsctp_conninput(static_cast<void *>(this), packet.data(), packet.len(), 0);
 }
 
 void DataChannelConnection::SendPacket(nsAutoPtr<MediaPacket> packet) {
   // LOG(("%p: SCTP/DTLS sent %ld bytes", this, len));
   if (!mTransportId.empty() && mTransportHandler) {
     mTransportHandler->SendPacket(mTransportId, std::move(*packet));
   }
@@ -2308,17 +2308,17 @@ 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();
+    MutexAutoLock lock(mLock);
     if (flags & MSG_NOTIFICATION) {
       HandleNotification(static_cast<union sctp_notification *>(data), datalen);
     } else {
       HandleMessage(data, datalen, ntohl(rcv.rcv_ppid), rcv.rcv_sid, flags);
     }
   }
   // sctp allocates 'data' with malloc(), and expects the receiver to free
   // it (presumably with free).