Skip to content

Commit 500a348

Browse files
committed
fix error value when opening a new stream
1 parent c6ed27c commit 500a348

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/h2/connection.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,9 @@ def send_headers(self,
793793
# Check we can open the stream.
794794
if stream_id not in self.streams:
795795
max_open_streams = self.remote_settings.max_concurrent_streams
796-
if (self.open_outbound_streams + 1) > max_open_streams:
797-
msg = f"Max outbound streams is {max_open_streams}, {self.open_outbound_streams} open"
796+
value = self.open_outbound_streams # take a copy due to the property accessor having side affects
797+
if (value + 1) > max_open_streams:
798+
msg = f"Max outbound streams is {max_open_streams}, {value} open"
798799
raise TooManyStreamsError(msg)
799800

800801
self.state_machine.process_input(ConnectionInputs.SEND_HEADERS)
@@ -1593,8 +1594,9 @@ def _receive_headers_frame(self, frame: HeadersFrame) -> tuple[list[Frame], list
15931594
# stream ID is valid.
15941595
if frame.stream_id not in self.streams:
15951596
max_open_streams = self.local_settings.max_concurrent_streams
1596-
if (self.open_inbound_streams + 1) > max_open_streams:
1597-
msg = f"Max outbound streams is {max_open_streams}, {self.open_outbound_streams} open"
1597+
value = self.open_inbound_streams # take a copy due to the property accessor having side affects
1598+
if (value + 1) > max_open_streams:
1599+
msg = f"Max inbound streams is {max_open_streams}, {value} open"
15981600
raise TooManyStreamsError(msg)
15991601

16001602
# Let's decode the headers. We handle headers as bytes internally up

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy