From 25ace0eb17b6cb283cd209669ab0c349b1f3eb1e Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 28 Oct 2018 15:39:15 +0100 Subject: [PATCH] Fix condition to set status to disconnected --- connector/syncthingconnection.cpp | 2 +- connector/tests/connectiontests.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/connector/syncthingconnection.cpp b/connector/syncthingconnection.cpp index c7a4c5a..c9f84b6 100644 --- a/connector/syncthingconnection.cpp +++ b/connector/syncthingconnection.cpp @@ -846,7 +846,7 @@ void SyncthingConnection::handleAdditionalRequestCanceled() if (m_reconnecting) { // if reconnection flag is set, instantly etstablish a new connection ... continueReconnecting(); - } else if (hasPendingRequests()) { + } else if (!hasPendingRequests()) { // ... otherwise declare we're disconnected if that was the last pending request setStatus(SyncthingStatus::Disconnected); } diff --git a/connector/tests/connectiontests.cpp b/connector/tests/connectiontests.cpp index d787166..1d0fd5b 100644 --- a/connector/tests/connectiontests.cpp +++ b/connector/tests/connectiontests.cpp @@ -592,6 +592,7 @@ void ConnectionTests::testRequestingQrCode() void ConnectionTests::testDisconnecting() { cerr << "\n - Disconnecting ..." << endl; + waitForConnected(); waitForConnection(defaultDisconnect(), 1000, connectionSignal(&SyncthingConnection::statusChanged)); CPPUNIT_ASSERT_EQUAL_MESSAGE("disconnected", QStringLiteral("disconnected"), m_connection.statusText()); }