From 3d7522b83f2c3f87116244bd064a751306a5411d Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sun, 19 Apr 2015 12:28:23 +0200 Subject: Avoid error message when initially starting resource. --- common/resourceaccess.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'common') diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index 1dba571..52cd61a 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp @@ -255,6 +255,14 @@ void ResourceAccess::disconnected() void ResourceAccess::connectionError(QLocalSocket::LocalSocketError error) { + //We tried to connect to the server, but the socket is not yet available. + //We're trying to connect but failed, start the resource and retry. + //Don't automatically restart on later disconnects. + if (d->openingConnection && error == QLocalSocket::LocalSocketError::ServerNotFoundError) { + startResourceAndConnect(); + return; + } + //Retry to connect to the server while starting the process if (d->startingProcess) { if (!d->tryOpenTimer->isActive()) { d->tryOpenTimer->start(); @@ -273,12 +281,6 @@ void ResourceAccess::connectionError(QLocalSocket::LocalSocketError error) handler(1, "The resource closed unexpectedly"); } d->resultHandler.clear(); - - //We're trying to connect but failed, start the resource and retry. - //Don't automatically restart on later disconnects. - if (d->openingConnection) { - startResourceAndConnect(); - } } void ResourceAccess::startResourceAndConnect() -- cgit v1.2.3