Commit b3866f5a authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #113 in ZP/z-push from bugfix/ZP-798-loopdetection-gets-stuck to develop

* commit 'c18dab8b':
  ZP-798 Fixed even more whitespace wishes.
  ZP-798 Fixed whitespace.
  ZP-798 Set maxCount to the current counter + the requested window size, to prevent maxCount being too high and LoopDetection to get stuck.

(cherry picked from commit ddfc97ff)
parent cec5dc21
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Created : 20.10.2011 * Created : 20.10.2011
* *
* Copyright 2007 - 2013 Zarafa Deutschland GmbH * Copyright 2007 - 2015 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
...@@ -572,12 +572,12 @@ class LoopDetection extends InterProcessData { ...@@ -572,12 +572,12 @@ class LoopDetection extends InterProcessData {
$obsolete = true; $obsolete = true;
} }
else { else {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("LoopDetection->IsSyncStateObsolete(): check folderid: '%s' uuid '%s' counter: %d - last counter: %d with %d queued", ZLog::Write(LOGLEVEL_DEBUG, sprintf("LoopDetection->IsSyncStateObsolete(): check folderid: '%s' uuid '%s' counter: %d - last counter: %d with %d queued",
$folderid, $uuid, $counter, $current["count"], $current["queued"])); $folderid, $uuid, $counter, $current["count"], $current["queued"]));
if ($current["uuid"] == $uuid && ( if ($current["uuid"] == $uuid && (
$current["count"] > $counter || $current["count"] > $counter ||
($current["count"] == $counter && $current["queued"] > 0) || ($current["count"] == $counter && $current["queued"] > 0) ||
(isset($current["usage"]) && $current["usage"] >= $counter) (isset($current["usage"]) && $current["usage"] >= $counter)
)) { )) {
$usage = isset($current["usage"]) ? sprintf(" - counter %d already expired",$current["usage"]) : ""; $usage = isset($current["usage"]) ? sprintf(" - counter %d already expired",$current["usage"]) : "";
...@@ -736,7 +736,7 @@ class LoopDetection extends InterProcessData { ...@@ -736,7 +736,7 @@ class LoopDetection extends InterProcessData {
ZLog::Write(LOGLEVEL_DEBUG, "LoopDetection->Detect(): case 3.1 detected - loop detected, init loop mode"); ZLog::Write(LOGLEVEL_DEBUG, "LoopDetection->Detect(): case 3.1 detected - loop detected, init loop mode");
$current['loopcount'] = 1; $current['loopcount'] = 1;
// the MaxCount is the max number of messages exported before // the MaxCount is the max number of messages exported before
$current['maxCount'] = $counter + (($maxItems < $queuedMessages)? $maxItems: $queuedMessages); $current['maxCount'] = $counter + (($maxItems < $queuedMessages) ? $maxItems : $queuedMessages);
$loop = true; // loop mode!! $loop = true; // loop mode!!
} }
else if ($queuedMessages == 0) { else if ($queuedMessages == 0) {
...@@ -758,7 +758,7 @@ class LoopDetection extends InterProcessData { ...@@ -758,7 +758,7 @@ class LoopDetection extends InterProcessData {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("LoopDetection->Detect(): case 3.3.1 detected - broken item should be next, attempt to ignore it - id '%s'", $current['potential'])); ZLog::Write(LOGLEVEL_DEBUG, sprintf("LoopDetection->Detect(): case 3.3.1 detected - broken item should be next, attempt to ignore it - id '%s'", $current['potential']));
$this->ignore_messageid = $current['potential']; $this->ignore_messageid = $current['potential'];
} }
$current['maxCount'] = $counter + $queuedMessages; $current['maxCount'] = $counter + (($maxItems < $queuedMessages) ? $maxItems : $queuedMessages);
$loop = true; // loop mode!! $loop = true; // loop mode!!
} }
} }
...@@ -958,4 +958,4 @@ class LoopDetection extends InterProcessData { ...@@ -958,4 +958,4 @@ class LoopDetection extends InterProcessData {
} }
} }
?> ?>
\ No newline at end of file
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