diff options
author | Moonchild <moonchild@palemoon.org> | 2023-01-18 02:26:23 +0100 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2023-01-18 02:26:23 +0100 |
commit | 304dfb8da27f8062b51e99034c77d83cddf21053 (patch) | |
tree | 5c66c96a752fbf73bd2b1a53206be97b5a7f6b37 /netwerk | |
parent | 2c4410681fae6ff6ab70671c8ae1a2fd381df6c8 (diff) | |
download | uxp-304dfb8da27f8062b51e99034c77d83cddf21053.tar.gz |
[network] Avoid queue manipulation inside a loop
Diffstat (limited to 'netwerk')
-rw-r--r-- | netwerk/protocol/http/Http2Session.cpp | 10 | ||||
-rw-r--r-- | netwerk/protocol/http/Http2Session.h | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/netwerk/protocol/http/Http2Session.cpp b/netwerk/protocol/http/Http2Session.cpp index 805ea09038..0bd9440034 100644 --- a/netwerk/protocol/http/Http2Session.cpp +++ b/netwerk/protocol/http/Http2Session.cpp @@ -1146,7 +1146,9 @@ Http2Session::RemoveStreamFromQueues(Http2Stream *aStream) } void -Http2Session::CloseStream(Http2Stream *aStream, nsresult aResult) +Http2Session::CloseStream(Http2Stream *aStream, + nsresult aResult, + bool aRemoveFromQueue) { MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread); LOG3(("Http2Session::CloseStream %p %p 0x%x %X\n", @@ -1161,7 +1163,9 @@ Http2Session::CloseStream(Http2Stream *aStream, nsresult aResult) mInputFrameDataStream = nullptr; } - RemoveStreamFromQueues(aStream); + if (aRemoveFromQueue) { + RemoveStreamFromQueues(aStream); + } if (aStream->IsTunnel()) { UnRegisterTunnel(aStream); @@ -1914,7 +1918,7 @@ Http2Session::RecvGoAway(Http2Session *self) if (self->mPeerGoAwayReason == HTTP_1_1_REQUIRED) { stream->Transaction()->DisableSpdy(); } - self->CloseStream(stream, NS_ERROR_NET_RESET); + self->CloseStream(stream, NS_ERROR_NET_RESET, false); self->mStreamTransactionHash.Remove(stream->Transaction()); } diff --git a/netwerk/protocol/http/Http2Session.h b/netwerk/protocol/http/Http2Session.h index d9a3c2b72b..9d6b8c8611 100644 --- a/netwerk/protocol/http/Http2Session.h +++ b/netwerk/protocol/http/Http2Session.h @@ -270,7 +270,7 @@ private: void GenerateGoAway(uint32_t); void CleanupStream(Http2Stream *, nsresult, errorType); void CleanupStream(uint32_t, nsresult, errorType); - void CloseStream(Http2Stream *, nsresult); + void CloseStream(Http2Stream *, nsresult, bool aRemoveFromQueue = true); void SendHello(); void RemoveStreamFromQueues(Http2Stream *); nsresult ParsePadding(uint8_t &, uint16_t &); |