summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@digia.com>2013-07-11 11:41:49 +0200
committerTim Jenssen <tim.jenssen@digia.com>2013-07-24 16:45:59 +0200
commit5fb7579d640d5007b641309cb1734b6e0bf2b1cc (patch)
treea6fef244f4ea6a1110688e0dde1947ff1602291b
parent6192896241a805909aecca491b9418c885830144 (diff)
Fix race condition when connecting to fs process
Fixes a regression introduced by 2a73db7e34b: We only tried to connect to the port 3 times immediately after the fs process was started, which might be too short. Instead, expicitly try to connect for 30 seconds, and only give up then. Task-number: QTIFW-316 Change-Id: I8a1ba59ff680f4ef536f13230215f2289ab3b0ed Reviewed-by: Niels Weber <niels.weber@digia.com>
-rw-r--r--src/libs/installer/fsengineclient.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libs/installer/fsengineclient.cpp b/src/libs/installer/fsengineclient.cpp
index 62e3cf871..abc686fd9 100644
--- a/src/libs/installer/fsengineclient.cpp
+++ b/src/libs/installer/fsengineclient.cpp
@@ -44,6 +44,8 @@
#include "adminauthorization.h"
#include "messageboxhandler.h"
+#include <QElapsedTimer>
+
#include <QtCore/QCoreApplication>
#include <QtCore/QMutex>
#include <QtCore/QProcess>
@@ -809,8 +811,14 @@ void FSEngineClientHandler::Private::maybeStartServer()
}
if (serverStarted) {
- QTcpSocket s; // now wait for the socket to arrive
- serverStarted = FSEngineClientHandler::instance().connect(&s);
+ QElapsedTimer t;
+ t.start();
+ while (serverStarting && serverStarted
+ && t.elapsed() < 30000) { // 30 seconds ought to be enough for the app to start
+ QTcpSocket s;
+ if (FSEngineClientHandler::instance().connect(&s))
+ serverStarting = false;
+ }
}
serverStarting = false;
}