[X2Go-Commits] [x2goclient] 241/281: 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
Thu Jan 19 13:06:08 CET 2017


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

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

commit 076fe4a3d9b79b2f8df63b6dc56ebdde9fc63da5
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 c4ed053..9e87aee 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -455,6 +455,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 4f7f173..70c9058 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -10597,17 +10597,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