From ceeddbd2190a344ef1d21b4abb0360f69d71bee1 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Thu, 7 Aug 2025 17:09:16 +0200 Subject: [PATCH] os: WaitForSomething(): also try to flush out older buffer content Always try to flush out anything we have, even for clients that had been stuck for a short while because we've tried to send out too much at once. If we'd only do it when someting *new* is in the queue, then those clients might get stuck for long time, until something else triggers the flush by mere accident. Signed-off-by: Enrico Weigelt, metux IT consult --- os/WaitFor.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/os/WaitFor.c b/os/WaitFor.c index 992962df4b..762a591581 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -198,8 +198,15 @@ WaitForSomething(Bool are_ready) timeout = 0; BlockHandler(&timeout); - if (NewOutputPending) - FlushAllOutput(); + + /* Always try to flush out anything we have, even for clients that had + been stuck for a short while because we've tried to send out too + much at once. If we'd only do it when someting *new* is in the queue, + then those clients might get stuck for long time, until something else + triggers the flush by mere accident. + */ + FlushAllOutput(); + /* keep this check close to select() call to minimize race */ if (dispatchException) i = -1;