Page MenuHomePhorge

D5418.1776171262.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D5418.1776171262.diff

diff --git a/lib/ext/Syncroton/Command/FolderSync.php b/lib/ext/Syncroton/Command/FolderSync.php
--- a/lib/ext/Syncroton/Command/FolderSync.php
+++ b/lib/ext/Syncroton/Command/FolderSync.php
@@ -99,12 +99,10 @@
return;
} else {
// The synckey that is sent to us should already be existing, because we create it at the end,
- // however, the next one shouldn't
+ // however, the next one shouldn't. When it does exist it means that the same request has been resent,
+ // which can happen if the client failed to receive the response.
if ($this->_syncStateBackend->haveNext($this->_device, 'FolderSync', $syncKey)) {
$this->_syncKeyReused = true;
- if ($this->_logger instanceof Zend_Log) {
- $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " already known synckey $syncKey provided");
- }
}
}
if (!($this->_syncState = $this->_syncStateBackend->validate($this->_device, 'FolderSync', $syncKey)) instanceof Syncroton_Model_SyncState) {
@@ -112,6 +110,29 @@
$this->_logger->warn(__METHOD__ . '::' . __LINE__ . " invalid synckey $syncKey provided, invalidating sync state");
}
$this->_syncStateBackend->resetState($this->_device, 'FolderSync');
+ } else {
+ // Keep track of how many times we retried this particular sync-key
+ if ($this->_syncKeyReused) {
+ $extraData = json_decode($this->_syncState->extraData, true);
+ $retryCounter = $extraData['retryCounter'] ?? 0;
+ $retryCounter++;
+ if ($this->_logger instanceof Zend_Log) {
+ $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " already known synckey $syncKey provided ($retryCounter times)");
+ }
+ if ($retryCounter >= 10) {
+ if ($this->_logger instanceof Zend_Log) {
+ $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " This client is stuck on resending the same FolderSync synckey.");
+ }
+ } else {
+ $extraData['retryCounter'] = $retryCounter;
+ $this->_syncState->extraData = json_encode($extraData);
+ //Get rid of $counterNext for the update because that's not stored by teh model
+ $counterNext = $this->_syncState->counterNext;
+ unset($this->_syncState->counterNext);
+ $this->_syncStateBackend->update($this->_syncState);
+ $this->_syncState->counterNext = $counterNext;
+ }
+ }
}
}

File Metadata

Mime Type
text/plain
Expires
Tue, Apr 14, 12:54 PM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18834188
Default Alt Text
D5418.1776171262.diff (2 KB)

Event Timeline