aboutsummaryrefslogtreecommitdiff
path: root/libraries/LocalPeer/src
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-06-17 16:34:32 +0200
committerSefa Eyeoglu <contact@scrumplex.net>2022-06-17 16:34:32 +0200
commit9ec260619b48447e398445aecd6651d319b8217e (patch)
treef3e8dd12c37b61b0215e3e667a33d86e46f2e268 /libraries/LocalPeer/src
parent03e454b71d83aebbb534c5734ccd9093842da28c (diff)
downloadPrismLauncher-9ec260619b48447e398445aecd6651d319b8217e.tar.gz
PrismLauncher-9ec260619b48447e398445aecd6651d319b8217e.tar.bz2
PrismLauncher-9ec260619b48447e398445aecd6651d319b8217e.zip
fix: fix warnings reported by LGTM.com
Diffstat (limited to 'libraries/LocalPeer/src')
-rw-r--r--libraries/LocalPeer/src/LocalPeer.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/libraries/LocalPeer/src/LocalPeer.cpp b/libraries/LocalPeer/src/LocalPeer.cpp
index cb218466..2c996ae7 100644
--- a/libraries/LocalPeer/src/LocalPeer.cpp
+++ b/libraries/LocalPeer/src/LocalPeer.cpp
@@ -162,15 +162,15 @@ bool LocalPeer::sendMessage(const QByteArray &message, int timeout)
QLocalSocket socket;
bool connOk = false;
- for(int i = 0; i < 2; i++) {
+ int tries = 2;
+ for(int i = 0; i < tries; i++) {
// Try twice, in case the other instance is just starting up
socket.connectToServer(socketName);
connOk = socket.waitForConnected(timeout/2);
- if (connOk || i)
+ if (!connOk && i < (tries - 1))
{
- break;
+ std::this_thread::sleep_for(std::chrono::milliseconds(250));
}
- std::this_thread::sleep_for(std::chrono::milliseconds(250));
}
if (!connOk)
{