/**
* Fiven an error from the network, map to a SyncFileItem::Status error
*/
-inline SyncFileItem::Status classifyError(QNetworkReply::NetworkError nerror, int httpCode) {
+inline SyncFileItem::Status classifyError(QNetworkReply::NetworkError nerror,
+ int httpCode,
+ bool* anotherSyncNeeded = NULL) {
Q_ASSERT (nerror != QNetworkReply::NoError); // we should only be called when there is an error
if (nerror > QNetworkReply::NoError && nerror <= QNetworkReply::UnknownProxyError) {
if (httpCode == 423) {
// "Locked"
// Should be temporary.
+ if (anotherSyncNeeded) { *anotherSyncNeeded = true; }
return SyncFileItem::SoftError;
}
SyncFileItem::Status status = job->errorStatus();
if (status == SyncFileItem::NoStatus) {
- status = classifyError(err, _item->_httpErrorCode);
+ status = classifyError(err, _item->_httpErrorCode,
+ &_propagator->_anotherSyncNeeded);
}
done(status, job->errorString());
return;
}
- SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode);
+ SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode,
+ &_propagator->_anotherSyncNeeded);
done(status, _job->errorString());
return;
}
if (_item->_httpErrorCode == 405) {
// This happens when the directory already exist. Nothing to do.
} else if (err != QNetworkReply::NoError) {
- SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode);
+ SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode,
+ &_propagator->_anotherSyncNeeded);
auto errorString = _job->reply()->errorString();
if (_job->reply()->hasRawHeader("OC-ErrorString")) {
errorString = _job->reply()->rawHeader("OC-ErrorString");
return;
}
- SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode);
+ SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode,
+ &_propagator->_anotherSyncNeeded);
done(status, _job->errorString());
return;
}
_propagator->_anotherSyncNeeded = true;
}
- abortWithError(classifyError(err, _item->_httpErrorCode), errorString);
+ SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode,
+ &_propagator->_anotherSyncNeeded);
+ abortWithError(status, errorString);
return;
}