From 1b6d4925b386651847389070d4b049ff50fc59f8 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Mon, 26 Oct 2026 13:14:55 +0300 Subject: [PATCH] Event loops: the callbacks' relay splices again A way with no length to keep to (CBALL) was counted down as data was written, so the check for it failed after the first write: the run of large reads that switches to splice() never got past one, and a stream was copied all along. Not counted down any more. Co-Authored-By: Claude Opus 5.5 --- src/mainloop.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mainloop.c b/src/mainloop.c index bf94ef9..99c4fd4 100644 --- a/src/mainloop.c +++ b/src/mainloop.c @@ -410,7 +410,7 @@ struct cbway { uint64_t inpipe; /* what the pipe holds */ }; -/* left of a way with no length to keep to */ +/* left of a way with no length to keep to: not counted down */ #define CBALL 0x7fffffffffffffffULL struct cbmap { @@ -603,7 +603,7 @@ static int cbway(struct cbmap *m, struct cbway *w){ SPLICE_F_NONBLOCK | SPLICE_F_MOVE); if(n > 0){ w->inpipe -= n; - w->left -= n; + if(w->left != CBALL) w->left -= n; cbcount(m, w, 1, n); progress = 1; } @@ -669,7 +669,7 @@ static int cbway(struct cbmap *m, struct cbway *w){ n = sf->_sendto(param->sostate, to, (char *)buf + *offset, (int)CBMIN(inb, w->left), 0, NULL, 0); if(n > 0){ *offset += n; - w->left -= n; + if(w->left != CBALL) w->left -= n; cbcount(m, w, 1, n); bufrelease(param, w->src? SERVER : CLIENT); progress = 1;