[X2Go-Commits] [x2goclient] 241/267: src/onmainwindow.cpp: move QProcess startup check in startSshd () to non-Windows code section and add a listening socket check loop.

git-admin at x2go.org git-admin at x2go.org
Sat Dec 10 13:36:24 CET 2016


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch bugfix/osx
in repository x2goclient.

commit b0e48db4a32e50319a642dc3595dddc0c0b580e4
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Oct 26 17:57:05 2016 +0200

    src/onmainwindow.cpp: move QProcess startup check in startSshd () to non-Windows code section and add a listening socket check loop.
    
    Windows uses other means of starting the daemon.
---
 debian/changelog     |    3 +++
 src/onmainwindow.cpp |   22 ++++++++++++++++++----
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a5017ac..ab9aa6a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -432,6 +432,9 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
       select the required key type (and maybe generate it if necessary.) Also
       use the new functions to get a stringified version of the key type etc.
     - macbuild.sh: switch to bundling PA 9.0.
+    - src/onmainwindow.cpp: move QProcess startup check in startSshd () to
+      non-Windows code section and add a listening socket check loop. Windows
+      uses other means of starting the daemon.
 
   [ Bernard Cafarelli ]
   * New upstream version (4.0.5.3):
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index c7820ef..8790a04 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -10564,17 +10564,31 @@ bool ONMainWindow::startSshd()
              etcDir+"/ssh_host_rsa_key"<<"-D"<<"-p"<<clientSshPort;
 
     sshd->start (binary, arguments);
-#endif /* defined (Q_OS_WIN) */
 
-    // Allow sshd a grace time of 5 seconds to come up.
-    QTime sleepTime = QTime::currentTime ().addSecs (5);
-    while (QTime::currentTime () < sleepTime) {
+    /* Allow sshd a grace time of 5 seconds to come up. */
+    QTime sleep_time = QTime::currentTime ().addSecs (5);
+    while (QTime::currentTime () < sleep_time) {
         if (QProcess::Running == sshd->state ()) {
+            /*
+             * Additionally, spin up to 3 seconds to give sshd
+             * the opportunity to launch its listening socket.
+             */
+            QTime new_sleep_time = QTime::currentTime ().addSecs (3);
+
+            while (QTime::currentTime () < new_sleep_time) {
+                if (isServerRunning (clientSshPort.toInt ())) {
+                    break;
+                }
+
+                QCoreApplication::processEvents (QEventLoop::AllEvents, 100);
+            }
+
             break;
         }
 
         QCoreApplication::processEvents (QEventLoop::AllEvents, 100);
     }
+#endif /* defined (Q_OS_WIN) */
 
     if (!isServerRunning (clientSshPort.toInt ())) {
         printSshDError_startupFailure ();

--
Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list