Fix reconnection after long network outage #2321

The problem was that StatusNotFound can indicate either a transient
network problem or a permanent server configuration problem.
This commit is contained in:
Christian Kamm 2015-02-11 09:23:04 +01:00
parent 4ff0d6635c
commit f8b24ac34d
3 changed files with 7 additions and 8 deletions

View file

@ -200,9 +200,14 @@ void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status sta
setState(Disconnected);
break;
case ConnectionValidator::ServerVersionMismatch:
case ConnectionValidator::StatusNotFound:
setState(ConfigurationError);
break;
case ConnectionValidator::StatusNotFound:
// This can happen either because the server does not exist
// or because we are having network issues. The latter one is
// much more likely, so keep trying to connect.
setState(NetworkError);
break;
case ConnectionValidator::CredentialsWrong:
account()->handleInvalidCredentials();
break;

View file

@ -52,11 +52,6 @@ QString ConnectionValidator::statusString( Status stat )
return QLatin1String("status undeclared.");
}
bool ConnectionValidator::isNetworkError( Status status )
{
return status == Timeout;
}
void ConnectionValidator::checkServerAndAuth()
{
if( !_account ) {
@ -100,7 +95,7 @@ void ConnectionValidator::slotStatusFound(const QUrl&url, const QVariantMap &inf
}
}
// status.php could not be loaded.
// status.php could not be loaded (network or server issue!).
void ConnectionValidator::slotNoStatusFound(QNetworkReply *reply)
{
_errors.append(tr("Unable to connect to %1").arg(_account->url().toString()));

View file

@ -80,7 +80,6 @@ public:
};
static QString statusString( Status );
static bool isNetworkError( Status status );
public slots:
/// Checks the server and the authentication.