Skip to content

Commit 5916cba

Browse files
committed
Don't attempt to write into transport if it is closing due to connection error. Fixes #180 and #185.
1 parent 807cb6f commit 5916cba

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

grpclib/protocol.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,8 @@ def __terminated__(self, reason: str) -> None:
476476

477477
@property
478478
def closable(self) -> bool:
479+
if self._transport.is_closing():
480+
return False
479481
if self._h2_connection.state_machine.state is ConnectionState.CLOSED:
480482
return False
481483
stream = self._h2_connection.streams.get(self.id)

0 commit comments

Comments
 (0)