WebRTC: Add explicit mutex on callback receiver for cases it's not already locked.
This commit is contained in:
parent
88c1cf71f7
commit
6db7e1fcbb
|
@ -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).
|
||||
|
|
Loading…
Reference in New Issue