summaryrefslogtreecommitdiffstats
path: root/tests/arthur/common/baselineprotocol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/arthur/common/baselineprotocol.cpp')
-rw-r--r--tests/arthur/common/baselineprotocol.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp
index 34d1a04..01ae67a 100644
--- a/tests/arthur/common/baselineprotocol.cpp
+++ b/tests/arthur/common/baselineprotocol.cpp
@@ -3,6 +3,7 @@
#include <QImage>
#include <QBuffer>
#include <QHostInfo>
+#include <QTest>
PlatformInfo::PlatformInfo(bool useLocal)
{
@@ -145,11 +146,17 @@ bool BaselineProtocol::connect()
if (serverName.isNull())
serverName = "chimera.europe.nokia.com";
- socket.connectToHost(serverName, ServerPort);
-
- if (!socket.waitForConnected(Timeout)) {
- errMsg += QLatin1String("TCP connectToHost failed. Host:") + serverName + QLatin1String(" port:") + QString::number(ServerPort);
- return false;
+ for (int i = 0; i < 2; i++) {
+ socket.connectToHost(serverName, ServerPort);
+ if (!socket.waitForConnected(Timeout)) {
+ if (!i && socket.error() == QAbstractSocket::ConnectionRefusedError) {
+ QTest::qSleep(3000); // In case the server is just restarting, we try again
+ continue;
+ }
+ errMsg += QLatin1String("TCP connectToHost failed. Host:") + serverName + QLatin1String(" port:") + QString::number(ServerPort);
+ return false;
+ }
+ break;
}
PlatformInfo pi(true);