Commit 19619eb1 authored by sebastian's avatar sebastian

ZP-621 #comment do not let LoopDetection perform a full FolderResync after...

ZP-621 #comment do not let LoopDetection perform a full FolderResync after several SYNC_PINGSTATUS_FOLDERHIERSYNCREQUIRED if the following FolderSync command exports changes

git-svn-id: https://z-push.org/svn/z-push/trunk@1958 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 8deac821
...@@ -217,7 +217,7 @@ class LoopDetection extends InterProcessData { ...@@ -217,7 +217,7 @@ class LoopDetection extends InterProcessData {
$lookback = self::$start - 600; // look at the last 5 min $lookback = self::$start - 600; // look at the last 5 min
foreach ($this->getProcessStack() as $se) { foreach ($this->getProcessStack() as $se) {
if ($se['time'] > $lookback && $se['time'] < (self::$start-1)) { if ($se['time'] > $lookback && $se['time'] < (self::$start-1)) {
// look for sync command // look for status codes of sync or ping commands
if (isset($se['stat']) && ($se['cc'] == ZPush::COMMAND_SYNC || $se['cc'] == ZPush::COMMAND_PING)) { if (isset($se['stat']) && ($se['cc'] == ZPush::COMMAND_SYNC || $se['cc'] == ZPush::COMMAND_PING)) {
foreach($se['stat'] as $key => $value) { foreach($se['stat'] as $key => $value) {
if (!isset($seenFailed[$key])) if (!isset($seenFailed[$key]))
...@@ -229,9 +229,14 @@ class LoopDetection extends InterProcessData { ...@@ -229,9 +229,14 @@ class LoopDetection extends InterProcessData {
// look for FolderSync command with previous failed commands // look for FolderSync command with previous failed commands
if ($se['cc'] == ZPush::COMMAND_FOLDERSYNC && !empty($seenFailed) && $se['id'] != self::GetProcessIdentifier()) { if ($se['cc'] == ZPush::COMMAND_FOLDERSYNC && !empty($seenFailed) && $se['id'] != self::GetProcessIdentifier()) {
// a full folderresync was already triggered // a full folderresync was already triggered
if (isset($se['stat']) && isset($se['stat']['hierarchy']) && $se['stat']['hierarchy'] == SYNC_FSSTATUS_SYNCKEYERROR) { if (isset($se['stat']) && isset($se['stat']['hierarchy']) && ($se['stat']['hierarchy'] == SYNC_FSSTATUS_SYNCKEYERROR || $se['stat']['hierarchy'] == 0)) { // 0 means changes have been exported, see FolderSync happy case
ZLog::Write(LOGLEVEL_DEBUG, "LoopDetection->ProcessLoopDetectionIsHierarchyResyncRequired(): a full FolderReSync was already requested. Resetting fail counter."); if ($se['stat']['hierarchy'] == SYNC_FSSTATUS_SYNCKEYERROR) {
$seenFailed = array(); ZLog::Write(LOGLEVEL_DEBUG, "LoopDetection->ProcessLoopDetectionIsHierarchyResyncRequired(): a full FolderReSync was already requested. Resetting fail counter.");
}
else {
ZLog::Write(LOGLEVEL_DEBUG, "LoopDetection->ProcessLoopDetectionIsHierarchyResyncRequired(): FolderSync did export changes, resetting fail counter.");
}
$seenFailed['hierarchy'] = 0;
} }
else { else {
$seenFolderSync = true; $seenFolderSync = true;
......
...@@ -258,6 +258,10 @@ class FolderSync extends RequestProcessor { ...@@ -258,6 +258,10 @@ class FolderSync extends RequestProcessor {
// everything fine, save the sync state for the next time // everything fine, save the sync state for the next time
if ($synckey == $newsynckey) if ($synckey == $newsynckey)
self::$deviceManager->GetStateManager()->SetSyncState($newsynckey, $newsyncstate); self::$deviceManager->GetStateManager()->SetSyncState($newsynckey, $newsyncstate);
// Announce that everything is fine and that changes were exported
if ($changeCount > 0)
self::$deviceManager->AnnounceProcessStatus(false, 0);
} }
} }
self::$encoder->endTag(); self::$encoder->endTag();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment