@@ -793,8 +793,9 @@ def send_headers(self,
793
793
# Check we can open the stream.
794
794
if stream_id not in self .streams :
795
795
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_inbound_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"
798
799
raise TooManyStreamsError (msg )
799
800
800
801
self .state_machine .process_input (ConnectionInputs .SEND_HEADERS )
@@ -1593,8 +1594,9 @@ def _receive_headers_frame(self, frame: HeadersFrame) -> tuple[list[Frame], list
1593
1594
# stream ID is valid.
1594
1595
if frame .stream_id not in self .streams :
1595
1596
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 outbound streams is { max_open_streams } , { value } open"
1598
1600
raise TooManyStreamsError (msg )
1599
1601
1600
1602
# Let's decode the headers. We handle headers as bytes internally up
0 commit comments