From 4fb50526bd17c34ae84454051680368f6e646def Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 4 Apr 2023 17:13:27 +0200 Subject: [PATCH] Suppress "connection refused" errors when stopping Syncthing ourselves When stopping the Syncthing service ourselves we can apparently also get "connection refused" and not just "remote host closed". So this kind of error should be supressed as well. --- syncthingwidgets/misc/internalerror.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/syncthingwidgets/misc/internalerror.cpp b/syncthingwidgets/misc/internalerror.cpp index 53defe8..0f02451 100644 --- a/syncthingwidgets/misc/internalerror.cpp +++ b/syncthingwidgets/misc/internalerror.cpp @@ -36,9 +36,9 @@ bool InternalError::isRelevant(const SyncthingConnection &connection, SyncthingE } // consider process/launcher or systemd unit status - const auto remoteHostClosed(networkError == QNetworkReply::RemoteHostClosedError || networkError == QNetworkReply::ProxyConnectionClosedError); - // ignore "remote host closed" error if we've just stopped Syncthing ourselves - const auto *launcher(SyncthingLauncher::mainInstance()); + const auto remoteHostClosed = networkError == QNetworkReply::ConnectionRefusedError || networkError == QNetworkReply::RemoteHostClosedError + || networkError == QNetworkReply::ProxyConnectionClosedError; + // ignore "remote host closed" error if we've just stopped Syncthing ourselves (or "connection refused" which can also be the result of stopping Syncthing ourselves) if (settings.launcher.considerForReconnect && remoteHostClosed && launcher && launcher->isManuallyStopped()) { return false; }