summaryrefslogtreecommitdiffstats
path: root/tests/arthur/common
diff options
context:
space:
mode:
authoraavit <qt-info@nokia.com>2010-09-09 08:46:34 (GMT)
committeraavit <qt-info@nokia.com>2010-09-09 08:46:34 (GMT)
commit3c29f241cebf18f4927579e054e2906915328cac (patch)
treeb6dd1463026184ff86621d3bdfa2f5508947e255 /tests/arthur/common
parent4d89a1dc2ea1f1dfbb6109d940496e924185fe13 (diff)
downloadQt-3c29f241cebf18f4927579e054e2906915328cac.zip
Qt-3c29f241cebf18f4927579e054e2906915328cac.tar.gz
Qt-3c29f241cebf18f4927579e054e2906915328cac.tar.bz2
Improved server logging and more robust client connection attempt
Also misc minor improvements all around
Diffstat (limited to 'tests/arthur/common')
-rw-r--r--tests/arthur/common/baselineprotocol.cpp17
-rw-r--r--tests/arthur/common/baselineprotocol.h3
2 files changed, 12 insertions, 8 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);
diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h
index 5427023..062a99c 100644
--- a/tests/arthur/common/baselineprotocol.h
+++ b/tests/arthur/common/baselineprotocol.h
@@ -111,7 +111,4 @@ private:
};
-
-
-
#endif // BASELINEPROTOCOL_H