Consider more error types when ignoring disconnects
See https://github.com/Martchus/syncthingtray/issues/79#issuecomment-716136144
This commit is contained in:
parent
bacca0241a
commit
a18ade7a36
|
@ -35,7 +35,7 @@ bool InternalError::isRelevant(const SyncthingConnection &connection, SyncthingE
|
|||
}
|
||||
|
||||
// consider process/launcher or systemd unit status
|
||||
const auto remoteHostClosed(networkError == QNetworkReply::RemoteHostClosedError);
|
||||
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());
|
||||
if (settings.launcher.considerForReconnect && remoteHostClosed && launcher && launcher->isManuallyStopped()) {
|
||||
|
@ -49,23 +49,32 @@ bool InternalError::isRelevant(const SyncthingConnection &connection, SyncthingE
|
|||
#endif
|
||||
|
||||
// ignore inavailability after start or standby-wakeup
|
||||
if (settings.ignoreInavailabilityAfterStart && networkError == QNetworkReply::ConnectionRefusedError) {
|
||||
if ((launcher && launcher->isRunning())
|
||||
if (settings.ignoreInavailabilityAfterStart) {
|
||||
switch (networkError) {
|
||||
case QNetworkReply::ConnectionRefusedError:
|
||||
case QNetworkReply::HostNotFoundError:
|
||||
case QNetworkReply::TemporaryNetworkFailureError:
|
||||
case QNetworkReply::NetworkSessionFailedError:
|
||||
case QNetworkReply::ProxyConnectionRefusedError:
|
||||
case QNetworkReply::ProxyNotFoundError:
|
||||
if ((launcher && launcher->isRunning())
|
||||
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
||||
&& ((service && service->isSystemdAvailable()
|
||||
&& !service->isActiveWithoutSleepFor(launcher->activeSince(), settings.ignoreInavailabilityAfterStart))
|
||||
|| !launcher->isActiveFor(settings.ignoreInavailabilityAfterStart))
|
||||
&& ((service && service->isSystemdAvailable()
|
||||
&& !service->isActiveWithoutSleepFor(launcher->activeSince(), settings.ignoreInavailabilityAfterStart))
|
||||
|| !launcher->isActiveFor(settings.ignoreInavailabilityAfterStart))
|
||||
#else
|
||||
&& !launcher->isActiveFor(settings.ignoreInavailabilityAfterStart)
|
||||
&& !launcher->isActiveFor(settings.ignoreInavailabilityAfterStart)
|
||||
#endif
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
||||
if (service && !service->isActiveWithoutSleepFor(settings.ignoreInavailabilityAfterStart)) {
|
||||
return false;
|
||||
}
|
||||
if (service && !service->isActiveWithoutSleepFor(settings.ignoreInavailabilityAfterStart)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue