Commit de8436fa authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-741 Remove folder type from the loop detection data.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 585a812a
...@@ -513,7 +513,7 @@ class DeviceManager { ...@@ -513,7 +513,7 @@ class DeviceManager {
* @access public * @access public
* @return int * @return int
*/ */
public function GetWindowSize($folderid, $type, $uuid, $statecounter, $queuedmessages) { public function GetWindowSize($folderid, $uuid, $statecounter, $queuedmessages) {
if (isset($this->windowSize[$folderid])) if (isset($this->windowSize[$folderid]))
$items = $this->windowSize[$folderid]; $items = $this->windowSize[$folderid];
else else
...@@ -522,7 +522,7 @@ class DeviceManager { ...@@ -522,7 +522,7 @@ class DeviceManager {
$this->setLatestFolder($folderid); $this->setLatestFolder($folderid);
// detect if this is a loop condition // detect if this is a loop condition
if ($this->loopdetection->Detect($folderid, $type, $uuid, $statecounter, $items, $queuedmessages)) if ($this->loopdetection->Detect($folderid, $uuid, $statecounter, $items, $queuedmessages))
$items = ($items == 0) ? 0: 1+($this->loopdetection->IgnoreNextMessage(false)?1:0) ; $items = ($items == 0) ? 0: 1+($this->loopdetection->IgnoreNextMessage(false)?1:0) ;
if ($items >= 0 && $items <= 2) if ($items >= 0 && $items <= 2)
......
...@@ -616,7 +616,6 @@ class LoopDetection extends InterProcessData { ...@@ -616,7 +616,6 @@ class LoopDetection extends InterProcessData {
* 3.3.1) item identified, loopcount >= 3 -> ignore item, set ignoredata flag * 3.3.1) item identified, loopcount >= 3 -> ignore item, set ignoredata flag
* *
* @param string $folderid the current folder id to be worked on * @param string $folderid the current folder id to be worked on
* @param string $type the type of that folder (Email, Calendar, Contact, Task)
* @param string $uuid the synkkey * @param string $uuid the synkkey
* @param string $counter the synckey counter * @param string $counter the synckey counter
* @param string $maxItems the current amount of items to be sent to the mobile * @param string $maxItems the current amount of items to be sent to the mobile
...@@ -625,8 +624,8 @@ class LoopDetection extends InterProcessData { ...@@ -625,8 +624,8 @@ class LoopDetection extends InterProcessData {
* @access public * @access public
* @return boolean when returning true if a loop has been identified * @return boolean when returning true if a loop has been identified
*/ */
public function Detect($folderid, $type, $uuid, $counter, $maxItems, $queuedMessages) { public function Detect($folderid, $uuid, $counter, $maxItems, $queuedMessages) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("LoopDetection->Detect(): folderid:'%s' type:'%s' uuid:'%s' counter:'%s' max:'%s' queued:'%s'", $folderid, $type, $uuid, $counter, $maxItems, $queuedMessages)); ZLog::Write(LOGLEVEL_DEBUG, sprintf("LoopDetection->Detect(): folderid:'%s' uuid:'%s' counter:'%s' max:'%s' queued:'%s'", $folderid, $uuid, $counter, $maxItems, $queuedMessages));
$this->broken_message_uuid = $uuid; $this->broken_message_uuid = $uuid;
$this->broken_message_counter = $counter; $this->broken_message_counter = $counter;
...@@ -652,16 +651,10 @@ class LoopDetection extends InterProcessData { ...@@ -652,16 +651,10 @@ class LoopDetection extends InterProcessData {
// completely new/unknown UUID // completely new/unknown UUID
if (empty($current)) if (empty($current))
$current = array("type" => $type, "uuid" => $uuid, "count" => $counter-1, "queued" => $queuedMessages); $current = array("uuid" => $uuid, "count" => $counter-1, "queued" => $queuedMessages);
// if data was created by SetSyncStateUsage(), we need to set the type
// TODO ZP-741: type is not used anywhere and could be removed from the loop data
if (isset($current['uuid']) && $current['uuid'] == $uuid && !isset($current['type'])) {
$current['type'] = $type;
}
// old UUID in cache - the device requested a new state!! // old UUID in cache - the device requested a new state!!
if (isset($current['type']) && $current['type'] == $type && isset($current['uuid']) && $current['uuid'] != $uuid ) { if (isset($current['uuid']) && $current['uuid'] != $uuid ) {
ZLog::Write(LOGLEVEL_DEBUG, "LoopDetection->Detect(): UUID changed for folder"); ZLog::Write(LOGLEVEL_DEBUG, "LoopDetection->Detect(): UUID changed for folder");
// some devices (iPhones) may request new UUIDs after broken items were sent several times // some devices (iPhones) may request new UUIDs after broken items were sent several times
...@@ -687,7 +680,6 @@ class LoopDetection extends InterProcessData { ...@@ -687,7 +680,6 @@ class LoopDetection extends InterProcessData {
// see if there are values // see if there are values
if (isset($current['uuid']) && $current['uuid'] == $uuid && if (isset($current['uuid']) && $current['uuid'] == $uuid &&
isset($current['type']) && $current['type'] == $type &&
isset($current['count'])) { isset($current['count'])) {
// case 1 - standard, during loop-resolving & resolving // case 1 - standard, during loop-resolving & resolving
......
...@@ -1034,7 +1034,7 @@ class Sync extends RequestProcessor { ...@@ -1034,7 +1034,7 @@ class Sync extends RequestProcessor {
} }
if($sc->GetParameter($spa, "getchanges") && $spa->HasFolderId() && $spa->HasContentClass() && $spa->HasSyncKey()) { if($sc->GetParameter($spa, "getchanges") && $spa->HasFolderId() && $spa->HasContentClass() && $spa->HasSyncKey()) {
$windowSize = self::$deviceManager->GetWindowSize($spa->GetFolderId(), $spa->GetContentClass(), $spa->GetUuid(), $spa->GetUuidCounter(), $changecount); $windowSize = self::$deviceManager->GetWindowSize($spa->GetFolderId(), $spa->GetUuid(), $spa->GetUuidCounter(), $changecount);
// limit windowSize to the max available limit of the global window size left // limit windowSize to the max available limit of the global window size left
$globallyAvailable = $sc->GetGlobalWindowSize() - $this->globallyExportedItems; $globallyAvailable = $sc->GetGlobalWindowSize() - $this->globallyExportedItems;
......
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