Propagation: Try another sync on 423 Locked #3387
authorChristian Kamm <mail@ckamm.de>
Wed, 30 Sep 2015 13:34:50 +0000 (15:34 +0200)
committerChristian Kamm <mail@ckamm.de>
Fri, 2 Oct 2015 12:49:38 +0000 (14:49 +0200)
(cherry picked from commit 24c41ed0da00b61e1bb761594147e463fabb7aa0)

src/libsync/owncloudpropagator_p.h
src/libsync/propagatedownload.cpp
src/libsync/propagateremotedelete.cpp
src/libsync/propagateremotemkdir.cpp
src/libsync/propagateremotemove.cpp
src/libsync/propagateupload.cpp

index c3c68aa7126e2de058932f4b511bc4f5d2919843..293038a2bb90a351e164668d43c631b69e61085a 100644 (file)
@@ -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) {
@@ -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;
     }
 
index e1e4ed489517fb85c8263bdc926ea67d0ba5bb1f..799bba641ab31cff2c62b2120d7c6804f7a28b91 100644 (file)
@@ -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());
index 5f7fc897ffb141b54c07ea93343e526b965f9c29..645370681bf7d59e98c5fff6672bdad27ad2c0bd 100644 (file)
@@ -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;
     }
index 6d97ec1e308cf523f4fcf994bb4cc5ce122cfc91..019a2b19c9027fa25cf1c9d67462dbc3a7fdd764 100644 (file)
@@ -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");
index 8b9af4eb12a39824dcdf79a940ce5a545f3b7cdb..8df44a73eaafda3c550c94774c90555d460ffcd0 100644 (file)
@@ -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;
     }
index 0ef14c0234e894125a597221a0a7510aad7c65df..e90fee64dca6c41213ad9f122ec5aff1e4f8d33c 100644 (file)
@@ -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;
     }