Skip to content

Commit

Permalink
Bug 1629529 - fix shutdown dispatch assert in WebrtcTCPSocket. r=bwc
Browse files Browse the repository at this point in the history
If we're shutting down and mSocketThread is no longer accepting work,
this dispatch can fail.  As far as I can see, fully fixing this would
require changes to nsIThread in order to allow checking whether the
thread is shutting down.

Differential Revision: https://phabricator.services.mozilla.com/D71964
  • Loading branch information
mfromanmoz committed Apr 24, 2020
1 parent 5a6ceff commit a38385b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions media/mtransport/ipc/WebrtcTCPSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,17 @@ void WebrtcTCPSocket::CloseWithReason(nsresult aReason) {
// Let's pretend we got an open even if we didn't to prevent an Open later.
mOpened = true;

MOZ_ALWAYS_SUCCEEDS(mSocketThread->Dispatch(NewRunnableMethod<nsresult>(
"WebrtcTCPSocket::CloseWithReason", this,
&WebrtcTCPSocket::CloseWithReason, aReason)));
DebugOnly<nsresult> rv =
mSocketThread->Dispatch(NewRunnableMethod<nsresult>(
"WebrtcTCPSocket::CloseWithReason", this,
&WebrtcTCPSocket::CloseWithReason, aReason));

// This was MOZ_ALWAYS_SUCCEEDS, but that now uses MOZ_DIAGNOSTIC_ASSERT.
// In order to convert this back to MOZ_ALWAYS_SUCCEEDS we would need
// OnSocketThread to return true if we're shutting down and doing the
// "running all of STS's queued events on main" thing.
MOZ_ASSERT(NS_SUCCEEDED(rv));

return;
}

Expand Down

0 comments on commit a38385b

Please sign in to comment.