summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-11-04 19:22:36 +0000
committerMoonchild <moonchild@palemoon.org>2022-04-04 22:06:07 +0200
commitbdfc1adbd20b7b5e0c2c7c6e1ad87278822edefa (patch)
tree8bfe60c32c52dd15e4f8beb9cdd66714af084180
parentf990d9a46ae66c5f0261cac4e33b755906456702 (diff)
downloaduxp-bdfc1adbd20b7b5e0c2c7c6e1ad87278822edefa.tar.gz
[network] Make several variables atomic in nsSocketTransport2.
Fixes potential thread races between: - nsSocketTransport::OnInputClosed and nsSocketTransport::OpenInputStream. - nsSocketTransport::OnOutputClosed and nsSocketTransport::OpenOutputStream. - nsSocketTransport::Close and nsSocketTransport::RecoverFromError called from OnSocketDetached.
-rw-r--r--netwerk/base/nsSocketTransport2.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/netwerk/base/nsSocketTransport2.h b/netwerk/base/nsSocketTransport2.h
index 310cc58d3b..60084d53e2 100644
--- a/netwerk/base/nsSocketTransport2.h
+++ b/netwerk/base/nsSocketTransport2.h
@@ -306,6 +306,9 @@ private:
uint16_t SocketPort() { return (!mProxyHost.IsEmpty() && !mProxyTransparent) ? mProxyPort : mPort; }
const nsCString &SocketHost() { 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)
@@ -314,8 +317,6 @@ private:
// socket state vars:
uint32_t mState; // STATE_??? flags
bool mAttached;
- bool mInputClosed;
- bool mOutputClosed;
// The platform-specific network interface id that this socket
// associated with.
@@ -455,7 +456,7 @@ private:
int32_t mKeepaliveRetryIntervalS;
int32_t mKeepaliveProbeCount;
- bool mDoNotRetryToConnect;
+ Atomic<bool> mDoNotRetryToConnect = false;
};
} // namespace net