commit 709adbc66d6251cdadf0f3c54d7cd871784a5f8e
parent 2ed63cb909f43f3bd247783f75cd5d33e56a34aa
Author: agoloman <agoloman@mozilla.com>
Date: Wed, 19 Nov 2025 14:29:18 +0200
Revert "Bug 1966501 - Check fd is open before use, r=necko-reviewers,valentin" for causing failures @Http3Session.
This reverts commit cec17b64a17030a3a8726cfb4dea84f034be8263.
Diffstat:
5 files changed, 1 insertion(+), 25 deletions(-)
diff --git a/netwerk/base/nsIUDPSocket.idl b/netwerk/base/nsIUDPSocket.idl
@@ -273,13 +273,6 @@ interface nsIUDPSocket : nsISupports
*/
[noscript, notxpcom] void enableWritePoll();
- /**
- * isSocketClosed
- *
- * @return true when the socket is already closed.
- */
- [noscript, notxpcom] boolean isSocketClosed();
-
/**
* addOutputBytes
*
diff --git a/netwerk/base/nsUDPSocket.cpp b/netwerk/base/nsUDPSocket.cpp
@@ -1222,8 +1222,6 @@ void nsUDPSocket::EnableWritePoll() {
mPollFlags = (PR_POLL_WRITE | PR_POLL_READ | PR_POLL_EXCEPT);
}
-bool nsUDPSocket::IsSocketClosed() { return !!mFD; }
-
NS_IMETHODIMP
nsUDPSocket::SendBinaryStream(const nsACString& aHost, uint16_t aPort,
nsIInputStream* aStream) {
diff --git a/netwerk/protocol/http/Http3ConnectUDPStream.cpp b/netwerk/protocol/http/Http3ConnectUDPStream.cpp
@@ -266,8 +266,6 @@ int64_t Http3ConnectUDPStream::GetFileDescriptor() { return -1; }
void Http3ConnectUDPStream::EnableWritePoll() {}
-bool Http3ConnectUDPStream::IsSocketClosed() { return mSendState == SEND_DONE; }
-
void Http3ConnectUDPStream::AddOutputBytes(uint32_t aBytes) {}
void Http3ConnectUDPStream::AddInputBytes(uint32_t aBytes) {}
diff --git a/netwerk/protocol/http/Http3Session.cpp b/netwerk/protocol/http/Http3Session.cpp
@@ -439,11 +439,6 @@ nsresult Http3Session::ProcessInput(nsIUDPSocket* socket) {
LOG(("Http3Session::ProcessInput writer=%p [this=%p state=%d]",
mUdpConn.get(), this, mState));
- if (!socket || socket->IsSocketClosed()) {
- MOZ_DIAGNOSTIC_ASSERT(false, "UDP socket should still be open");
- return NS_ERROR_UNEXPECTED;
- }
-
if (mUseNSPRForIO) {
while (true) {
nsTArray<uint8_t> data;
@@ -1096,11 +1091,6 @@ nsresult Http3Session::ProcessOutput(nsIUDPSocket* socket) {
LOG(("Http3Session::ProcessOutput reader=%p, [this=%p]", mUdpConn.get(),
this));
- if (!socket || socket->IsSocketClosed()) {
- MOZ_DIAGNOSTIC_ASSERT(false, "UDP socket should still be open");
- return NS_ERROR_UNEXPECTED;
- }
-
if (mUseNSPRForIO) {
mSocket = socket;
nsresult rv = mHttp3Connection->ProcessOutputAndSendUseNSPRForIO(
diff --git a/netwerk/protocol/http/HttpConnectionUDP.cpp b/netwerk/protocol/http/HttpConnectionUDP.cpp
@@ -619,9 +619,6 @@ void HttpConnectionUDP::Close(nsresult reason, bool aIsShutdown) {
socket->Close();
}
- MOZ_DIAGNOSTIC_ASSERT(!mHttp3Session || mHttp3Session->IsClosed(),
- "Http3Session should already be closed");
-
for (const auto& trans : mQueuedHttpConnectTransaction) {
trans->Close(reason);
}
@@ -721,7 +718,7 @@ nsresult HttpConnectionUDP::OnHeadersAvailable(nsAHttpTransaction* trans,
// response headers so that it will be ready to receive the new response.
if (mIsReused &&
((PR_IntervalNow() - mHttp3Session->LastWriteTime()) < k1000ms)) {
- CloseTransaction(mHttp3Session, NS_ERROR_NET_RESET);
+ Close(NS_ERROR_NET_RESET);
*reset = true;
return NS_OK;
}