Bug 1712671 - Make nsSocketTransport2::m{Input/Output}StreamClosed atomic. r=kershaw,decoder a=RyanVM

Fixes race between nsSocketTransport::OnInputClosed and nsSocketTransport::OpenInputStream.
Same for output streams.

Differential Revision: https://phabricator.services.mozilla.com/D128183
This commit is contained in:
Valentin Gosu 2021-10-18 13:53:15 +00:00
parent 22470a9d77
commit c7a2989bc7
2 changed files with 3 additions and 4 deletions

View File

@ -221,8 +221,6 @@ extern "C" const char* __tsan_default_suppressions() {
// Bug 1606864
"race:nsSocketTransport::Close\n"
"race:nsSocketTransport::OnSocketDetached\n"
"race:nsSocketTransport::OnMsgInputClosed\n"
"race:nsSocketTransport::OpenOutputStream\n"
// Bug 1615017
"race:CacheFileMetadata::SetHash\n"

View File

@ -303,6 +303,9 @@ class nsSocketTransport final : public nsASocketHandler,
return (!mProxyHost.IsEmpty() && !mProxyTransparent) ? mProxyHost : mHost;
}
Atomic<bool> mInputClosed{true};
Atomic<bool> mOutputClosed{true};
//-------------------------------------------------------------------------
// members accessible only on the socket transport thread:
// (the exception being initialization/shutdown time)
@ -311,8 +314,6 @@ class nsSocketTransport final : public nsASocketHandler,
// socket state vars:
uint32_t mState{STATE_CLOSED}; // STATE_??? flags
bool mAttached{false};
bool mInputClosed{true};
bool mOutputClosed{true};
// this flag is used to determine if the results of a host lookup arrive
// recursively or not. this flag is not protected by any lock.