Skip to content

Commit ce3d443

Browse files
committed
Always set _closed future in StdoutWriterProtocol.connection_lost
Otherwise when the stdout stream is closed wait_closed will hang forvever. See #24 for discussion about the exact intended behavior or WriterProtocol in this case. QubesOS/qubes-issues#9779
1 parent 47259d4 commit ce3d443

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

splitgpg2/stdiostream.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ def resume_writing(self) -> None:
4343

4444
def connection_lost(self, exc: Optional[BaseException]) -> None:
4545
self._connection_lost = True
46+
4647
# Wake up the writer(s) if currently paused.
47-
if not self._paused:
48-
return
48+
if self._paused:
49+
for waiter in self._drain_waiters:
50+
if not waiter.done():
51+
if exc is None:
52+
waiter.set_result(None)
53+
else:
54+
waiter.set_exception(exc)
4955

50-
for waiter in self._drain_waiters:
51-
if not waiter.done():
52-
if exc is None:
53-
waiter.set_result(None)
54-
else:
55-
waiter.set_exception(exc)
5656
if not self._closed.done():
5757
if exc is None:
5858
self._closed.set_result(None)

0 commit comments

Comments
 (0)