]> source.dussan.org Git - tigervnc.git/commitdiff
Fix x0vncserver handling of timers
authorPierre Ossman <ossman@cendio.se>
Fri, 5 Jul 2024 11:24:52 +0000 (13:24 +0200)
committerPierre Ossman <ossman@cendio.se>
Fri, 5 Jul 2024 12:09:38 +0000 (14:09 +0200)
Bug fix for bf28683.

(cherry picked from commit 80ce950887824a120c8de07dac9191e7fff72de4)

unix/x0vncserver/x0vncserver.cxx

index ffaf57889b84b5b7c6530827a096ed490dccc2b7..d2999e250a06babb429a3f5484ebe528e3ddb12b 100644 (file)
@@ -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) {