From: Pierre Ossman Date: Fri, 5 Jul 2024 11:24:52 +0000 (+0200) Subject: Fix x0vncserver handling of timers X-Git-Tag: v1.14.0~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1086899e11eb690ffef79cdef6b02469d7edcf1c;p=tigervnc.git Fix x0vncserver handling of timers Bug fix for bf28683. (cherry picked from commit 80ce950887824a120c8de07dac9191e7fff72de4) --- 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) {