fix: fix warnings reported by LGTM.com

This commit is contained in:
Sefa Eyeoglu
2022-06-17 16:34:32 +02:00
parent 03e454b71d
commit 9ec260619b
8 changed files with 20 additions and 11 deletions

View File

@ -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)
{