[X2Go-Commits] [x2goclient] 243/267: src/onmainwindow.cpp: add listening-check loop to the Windows-specific code of startSshd ().

git-admin at x2go.org git-admin at x2go.org
Sat Dec 10 13:36:25 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 d7f796395416f8be78790da9153a3e123c5a406a
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Oct 26 18:01:52 2016 +0200

    src/onmainwindow.cpp: add listening-check loop to the Windows-specific code of startSshd ().
---
 debian/changelog     |    2 ++
 src/onmainwindow.cpp |   43 ++++++++++++++++++++++++++++++-------------
 2 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b80ab32..4c4e135 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -437,6 +437,8 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium
       uses other means of starting the daemon.
     - src/onmainwindow.cpp: add comment to last all-in listening check in
       startSshd ().
+    - src/onmainwindow.cpp: add listening-check loop to the Windows-specific
+      code of startSshd ().
 
   [ Bernard Cafarelli ]
   * New upstream version (4.0.5.3):
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index 49d67a9..17db351 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -10536,20 +10536,37 @@ bool ONMainWindow::startSshd()
     ZeroMemory ( &sshd, sizeof ( sshd ) );
     si.lpDesktop=desktop;
     si.cb = sizeof ( si );
-    CreateProcessA ( NULL,  // No module name (use command line)
-                     ( LPSTR ) strm.str().c_str(),  // Command line
-                     NULL,           // Process handle not inheritable
-                     NULL,           // Thread handle not inheritable
-                     TRUE,          // Set handle inheritance to FALSE
-                     0/*CREATE_NO_WINDOW|CREATE_NEW_PROCESS_GROUP*/,
-                     //creation flags
-                     NULL,           // Use parent's environment block
-                     clientdir.c_str(), // Starting directory
-                     &si,            // Pointer to STARTUPINFO structure
-                     &sshd );// Pointer to PROCESS_INFORMATION structure
-    /* FIXME: test successful SSH daemon startup */
+    const BOOL ret = CreateProcessA ( NULL,  // No module name (use command line)
+                                      ( LPSTR ) strm.str().c_str(),  // Command line
+                                      NULL,           // Process handle not inheritable
+                                      NULL,           // Thread handle not inheritable
+                                      TRUE,          // Set handle inheritance to FALSE
+                                      0/*CREATE_NO_WINDOW|CREATE_NEW_PROCESS_GROUP*/,
+                                      //creation flags
+                                      NULL,           // Use parent's environment block
+                                      clientdir.c_str(), // Starting directory
+                                      &si,            // Pointer to STARTUPINFO structure
+                                      &sshd );// Pointer to PROCESS_INFORMATION structure
+
+    /* Test successful SSH daemon startup for at most 5 seconds. */
+    if (ret) {
+        QTime sleep_time = QTime::currentTime ().addSecs (5);
+
+        while (QTime::currentTime () < sleep_time) {
+            if (isServerRunning (clientSshPort.toInt ())) {
+                winSshdStarted = true;
+
+                break;
+            }
+
+            QCoreApplication::processEvents (QEventLoop::AllEvents, 100);
+        }
+    }
+    else {
+        winSshdStarted = false;
+    }
+
     delete []desktop;
-    winSshdStarted=true;
 #else // defined (Q_OS_WIN)
     sshd=new QProcess ( this );
 

--
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