mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 10:18:38 +09:00
WebRTC: Add explicit mutex on callback receiver for cases it's not
already locked.
This commit is contained in:
parent
9ce73065ba
commit
f6f11db550
1 changed files with 10 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue