Skip to content

Commit

Permalink
Don't attempt to write into transport if it is closing due to connect…
Browse files Browse the repository at this point in the history
…ion error. Fixes #180 and #185.
  • Loading branch information
vmagamedov committed Apr 18, 2024
1 parent 807cb6f commit 5916cba
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions grpclib/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ def __terminated__(self, reason: str) -> None:

@property
def closable(self) -> bool:
if self._transport.is_closing():
return False
if self._h2_connection.state_machine.state is ConnectionState.CLOSED:
return False
stream = self._h2_connection.streams.get(self.id)
Expand Down

0 comments on commit 5916cba

Please sign in to comment.