Mac in the headset: no viewer cleanup while a Show is launching; relay pump always ends

Review round 10: a Show replacing its own stream could have its new viewer
ended by the cleanup; a viewer reset left the delayed relay pending.
Verified: the relay delivers what's queued, then closes the agent side.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
saphidandClaude Opus 5.5 committed 2026-09-28 21:11:26 +10:00
1 parent 7f769ca2f0
commit 484a50a189
3 files changed
+19 -4

No files matched your search

+5 -3
View File
@@ -173,9 +173,11 @@ class Relay:
writer.close()
async def pump():
while data := await reader.read(65536):
await queue.put((self.loop.time() + self.delay, data))
await queue.put((0, None))
try:
while data := await reader.read(65536):
await queue.put((self.loop.time() + self.delay, data))
finally: # EOF or a reset: either way the sender finishes and closes
queue.put_nowait((0, None))
sender, pumper = asyncio.ensure_future(send()), asyncio.ensure_future(pump())
done, _ = await asyncio.wait({sender, pumper}, return_when=asyncio.FIRST_COMPLETED)