From 1086899e11eb690ffef79cdef6b02469d7edcf1c Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 5 Jul 2024 13:24:52 +0200 Subject: [PATCH] Fix x0vncserver handling of timers Bug fix for bf28683. (cherry picked from commit 80ce950887824a120c8de07dac9191e7fff72de4) --- unix/x0vncserver/x0vncserver.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx index ffaf5788..d2999e25 100644 --- a/unix/x0vncserver/x0vncserver.cxx +++ b/unix/x0vncserver/x0vncserver.cxx @@ -417,7 +417,7 @@ int main(int argc, char** argv) if (!clients_connected) sched.reset(); - wait_ms = 0; + wait_ms = -1; if (sched.isRunning()) { wait_ms = sched.millisRemaining(); @@ -428,7 +428,7 @@ int main(int argc, char** argv) // Trigger timers and check when the next will expire nextTimeout = Timer::checkTimeouts(); - if (nextTimeout >= 0 && nextTimeout < wait_ms) + if (nextTimeout >= 0 && (wait_ms == -1 || nextTimeout < wait_ms)) wait_ms = nextTimeout; tv.tv_sec = wait_ms / 1000; @@ -437,7 +437,7 @@ int main(int argc, char** argv) // Do the wait... sched.sleepStarted(); int n = select(FD_SETSIZE, &rfds, &wfds, 0, - wait_ms ? &tv : NULL); + wait_ms >= 0 ? &tv : NULL); sched.sleepFinished(); if (n < 0) { -- 2.39.5