@@ -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