Skip to content

Commit

Permalink
Propagation: Try another sync on 423 Locked #3387
Browse files Browse the repository at this point in the history
(cherry picked from commit 24c41ed)
  • Loading branch information
ckamm committed Oct 2, 2015
1 parent 62eeed5 commit 3cbd63a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/libsync/owncloudpropagator_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ inline QByteArray getEtagFromReply(QNetworkReply *reply)
/**
* 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) {
Expand All @@ -72,6 +74,7 @@ inline SyncFileItem::Status classifyError(QNetworkReply::NetworkError nerror, in
if (httpCode == 423) {
// "Locked"
// Should be temporary.
if (anotherSyncNeeded) { *anotherSyncNeeded = true; }
return SyncFileItem::SoftError;
}

Expand Down
3 changes: 2 additions & 1 deletion src/libsync/propagatedownload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ void PropagateDownloadFileQNAM::slotGetFinished()

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());
Expand Down
3 changes: 2 additions & 1 deletion src/libsync/propagateremotedelete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ void PropagateRemoteDelete::slotDeleteJobFinished()
return;
}

SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode);
SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode,
&_propagator->_anotherSyncNeeded);
done(status, _job->errorString());
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/libsync/propagateremotemkdir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ void PropagateRemoteMkdir::slotMkcolJobFinished()
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");
Expand Down
3 changes: 2 additions & 1 deletion src/libsync/propagateremotemove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ void PropagateRemoteMove::slotMoveJobFinished()
return;
}

SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode);
SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode,
&_propagator->_anotherSyncNeeded);
done(status, _job->errorString());
return;
}
Expand Down
4 changes: 3 additions & 1 deletion src/libsync/propagateupload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,9 @@ void PropagateUploadFileQNAM::slotPutFinished()
_propagator->_anotherSyncNeeded = true;
}

abortWithError(classifyError(err, _item->_httpErrorCode), errorString);
SyncFileItem::Status status = classifyError(err, _item->_httpErrorCode,
&_propagator->_anotherSyncNeeded);
abortWithError(status, errorString);
return;
}

Expand Down

0 comments on commit 3cbd63a

Please sign in to comment.