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
|
// 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
|
// ignore "remote host closed" error if we've just stopped Syncthing ourselves
|
||||||
const auto *launcher(SyncthingLauncher::mainInstance());
|
const auto *launcher(SyncthingLauncher::mainInstance());
|
||||||
if (settings.launcher.considerForReconnect && remoteHostClosed && launcher && launcher->isManuallyStopped()) {
|
if (settings.launcher.considerForReconnect && remoteHostClosed && launcher && launcher->isManuallyStopped()) {
|
||||||
|
@ -49,23 +49,32 @@ bool InternalError::isRelevant(const SyncthingConnection &connection, SyncthingE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ignore inavailability after start or standby-wakeup
|
// ignore inavailability after start or standby-wakeup
|
||||||
if (settings.ignoreInavailabilityAfterStart && networkError == QNetworkReply::ConnectionRefusedError) {
|
if (settings.ignoreInavailabilityAfterStart) {
|
||||||
if ((launcher && launcher->isRunning())
|
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
|
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
||||||
&& ((service && service->isSystemdAvailable()
|
&& ((service && service->isSystemdAvailable()
|
||||||
&& !service->isActiveWithoutSleepFor(launcher->activeSince(), settings.ignoreInavailabilityAfterStart))
|
&& !service->isActiveWithoutSleepFor(launcher->activeSince(), settings.ignoreInavailabilityAfterStart))
|
||||||
|| !launcher->isActiveFor(settings.ignoreInavailabilityAfterStart))
|
|| !launcher->isActiveFor(settings.ignoreInavailabilityAfterStart))
|
||||||
#else
|
#else
|
||||||
&& !launcher->isActiveFor(settings.ignoreInavailabilityAfterStart)
|
&& !launcher->isActiveFor(settings.ignoreInavailabilityAfterStart)
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
#ifdef LIB_SYNCTHING_CONNECTOR_SUPPORT_SYSTEMD
|
||||||
if (service && !service->isActiveWithoutSleepFor(settings.ignoreInavailabilityAfterStart)) {
|
if (service && !service->isActiveWithoutSleepFor(settings.ignoreInavailabilityAfterStart)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue