summaryrefslogtreecommitdiff
path: root/src/detached/client.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/detached/client.zig')
-rw-r--r--src/detached/client.zig17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/detached/client.zig b/src/detached/client.zig
index 4769cf25..fc39164b 100644
--- a/src/detached/client.zig
+++ b/src/detached/client.zig
@@ -1129,9 +1129,20 @@ test "detached session: a frontend that stops reading is dropped, not waited for
for (0..24) |_| {
if (!h.session.clients[1].attached) break;
host.vtable.push_set_clipboard.?(host.ctx, text);
- try h.pump();
- try good.wait(5);
- while (try good.next()) |_| {}
+ // Read `good` back to EMPTY before the next mirror, rather than
+ // pumping once and taking whatever one write fitted. One pump moves at
+ // most one socket buffer, and that buffer is 8 KiB here
+ // (`net.local.stream.sendspace` on Darwin) against Linux's 208 KiB —
+ // so a single pump per 256 KiB mirror leaves the READING frontend
+ // falling behind by a quarter megabyte a round and closes it for a
+ // backlog it never caused. The claim under test is that a frontend
+ // that reads survives, so it has to actually finish reading.
+ for (0..256) |_| {
+ try h.pump();
+ try good.wait(5);
+ while (try good.next()) |_| {}
+ if (h.session.clients[0].out.items.len == 0) break;
+ }
}
// Dropped rather than queued without bound, and rather than the core
// blocking on it.