Skip to content

Commit 3d31c4c

Browse files
committed
Address potential race condition in SSHForwarder cleanup
Remove an assertion that can apparently trigger during cleanup in rare cases, where write_eof() is called multiple times. Thanks go to GitHub user misa-hase for reporting and helping to test this.
1 parent ce2ac1e commit 3d31c4c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

asyncssh/forward.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ def write(self, data: bytes) -> None:
9191
def write_eof(self) -> None:
9292
"""Write end of file to the transport"""
9393

94-
assert self._transport is not None
94+
if not self._transport:
95+
return # pragma: no cover
9596

9697
try:
9798
self._transport.write_eof()

0 commit comments

Comments
 (0)