From 5fb7579d640d5007b641309cb1734b6e0bf2b1cc Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 11 Jul 2013 11:41:49 +0200 Subject: 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 --- src/libs/installer/fsengineclient.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') 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 + #include #include #include @@ -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; } -- cgit v1.2.3