Fixed a problem with QueryConnect dialog not counting down seconds, and
also fixed an issue with not calling server's checkTimeouts() function
when there are no client connections.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/branches/merge-with-vnc-4.1.1@542 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/x0vncserver/x0vncserver.cxx b/x0vncserver/x0vncserver.cxx
index ae140fb..336350d 100644
--- a/x0vncserver/x0vncserver.cxx
+++ b/x0vncserver/x0vncserver.cxx
@@ -30,7 +30,7 @@
 #include <rfb/VNCServerST.h>
 #include <rfb/Configuration.h>
 #include <rfb/SSecurityFactoryStandard.h>
-
+#include <rfb/Timer.h>
 #include <network/TcpSocket.h>
 #include <tx/TXWindow.h>
 
@@ -510,6 +510,10 @@
         }
       }
 
+      Timer::checkTimeouts();
+      server.checkTimeouts();
+
+      // Client list could have been changed.
       server.getSockets(&sockets);
 
       // Nothing more to do if there are no client connections.
@@ -522,13 +526,7 @@
           server.processSocketEvent(*i);
       }
 
-      // Don't poll if the desktop object in not ready.
-      if (!desktop.isRunning())
-        continue;
-
-      server.checkTimeouts();
-
-      if (sched.goodTimeToPoll()) {
+      if (desktop.isRunning() && sched.goodTimeToPoll()) {
         sched.newPass();
         desktop.poll();
       }