diff --git a/dom/media/webrtc/transport/test/webrtcproxychannel_unittest.cpp b/dom/media/webrtc/transport/test/webrtcproxychannel_unittest.cpp index 001ec616257c..3a0b6a0c9412 100644 --- a/dom/media/webrtc/transport/test/webrtcproxychannel_unittest.cpp +++ b/dom/media/webrtc/transport/test/webrtcproxychannel_unittest.cpp @@ -189,6 +189,10 @@ class FakeSocketTransportProvider : public nsISocketTransport { MOZ_ASSERT(false); return NS_OK; } + NS_IMETHOD GetStatus(nsresult* aStatus) override { + MOZ_ASSERT(false); + return NS_OK; + } // nsITransport NS_IMETHOD OpenInputStream(uint32_t aFlags, uint32_t aSegmentSize, diff --git a/dom/presentation/MockedSocketTransport.cpp b/dom/presentation/MockedSocketTransport.cpp index ab28ef8059d9..d4716d6bb448 100644 --- a/dom/presentation/MockedSocketTransport.cpp +++ b/dom/presentation/MockedSocketTransport.cpp @@ -215,5 +215,8 @@ MockedSocketTransport::GetRetryDnsIfPossible(bool*) { return NS_ERROR_NOT_IMPLEMENTED; } +NS_IMETHODIMP +MockedSocketTransport::GetStatus(nsresult*) { return NS_ERROR_NOT_IMPLEMENTED; } + } // namespace dom } // namespace mozilla diff --git a/netwerk/base/nsISocketTransport.idl b/netwerk/base/nsISocketTransport.idl index d97bc2f11e6b..88792de64ea6 100644 --- a/netwerk/base/nsISocketTransport.idl +++ b/netwerk/base/nsISocketTransport.idl @@ -348,4 +348,9 @@ interface nsISocketTransport : nsITransport * e.g. NS_ERROR_CONNECTION_REFUSED, NS_ERROR_RESET, etc. */ readonly attribute boolean retryDnsIfPossible; + + /** + * Return the current status of the socket. + */ + [noscript] readonly attribute nsresult status; }; diff --git a/netwerk/base/nsSocketTransport2.cpp b/netwerk/base/nsSocketTransport2.cpp index 345c0911042a..d2e4c10dd07f 100644 --- a/netwerk/base/nsSocketTransport2.cpp +++ b/netwerk/base/nsSocketTransport2.cpp @@ -2564,10 +2564,6 @@ nsSocketTransport::GetPeerAddr(NetAddr* addr) { // we can freely access mNetAddr from any thread without being // inside a critical section. - if (NS_FAILED(mCondition)) { - return mCondition; - } - if (!mNetAddrIsSet) { SOCKET_LOG( ("nsSocketTransport::GetPeerAddr [this=%p state=%d] " @@ -2587,10 +2583,6 @@ nsSocketTransport::GetSelfAddr(NetAddr* addr) { // we can freely access mSelfAddr from any thread without being // inside a critical section. - if (NS_FAILED(mCondition)) { - return mCondition; - } - if (!mSelfAddrIsSet) { SOCKET_LOG( ("nsSocketTransport::GetSelfAddr [this=%p state=%d] " @@ -3374,5 +3366,13 @@ nsSocketTransport::GetRetryDnsIfPossible(bool* aRetryDns) { return NS_OK; } +NS_IMETHODIMP +nsSocketTransport::GetStatus(nsresult* aStatus) { + MOZ_ASSERT(OnSocketThread(), "not on socket thread"); + + *aStatus = mCondition; + return NS_OK; +} + } // namespace net } // namespace mozilla diff --git a/netwerk/protocol/http/Http3Session.cpp b/netwerk/protocol/http/Http3Session.cpp index 1d59e3ef8696..90a5c5e0b832 100644 --- a/netwerk/protocol/http/Http3Session.cpp +++ b/netwerk/protocol/http/Http3Session.cpp @@ -90,6 +90,12 @@ nsresult Http3Session::Init(const nsHttpConnectionInfo* aConnInfo, Unused << mSocketTransport->GetSecurityInfo(getter_AddRefs(info)); mSocketControl = do_QueryObject(info); + nsresult status = NS_OK; + Unused << mSocketTransport->GetStatus(&status); + if (NS_FAILED(status)) { + return status; + } + // Get the local and remote address neqo needs it. NetAddr selfAddr; nsresult rv = mSocketTransport->GetSelfAddr(&selfAddr); diff --git a/netwerk/protocol/http/TunnelUtils.cpp b/netwerk/protocol/http/TunnelUtils.cpp index 95bf37342012..f22e24fbc834 100644 --- a/netwerk/protocol/http/TunnelUtils.cpp +++ b/netwerk/protocol/http/TunnelUtils.cpp @@ -2152,6 +2152,11 @@ SocketTransportShim::GetRetryDnsIfPossible(bool* aRetry) { return mWrapped->GetRetryDnsIfPossible(aRetry); } +NS_IMETHODIMP +SocketTransportShim::GetStatus(nsresult* aStatus) { + return mWrapped->GetStatus(aStatus); +} + NS_IMPL_ISUPPORTS(TLSFilterTransaction, nsITimerCallback, nsINamed) NS_IMPL_ISUPPORTS(SocketTransportShim, nsISocketTransport, nsITransport) NS_IMPL_ISUPPORTS(InputStreamShim, nsIInputStream, nsIAsyncInputStream)