Commit a6c3f95f authored by skummer's avatar skummer

ZP-340 #comment mark 'Sync' connections with heartbeat also as push...

ZP-340 #comment mark 'Sync' connections with heartbeat also as push connections so the ProcessLoopDetection does not identify them as "still running" #time 1h

git-svn-id: https://z-push.org/svn/z-push/trunk@1634 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 336c974b
......@@ -610,6 +610,19 @@ class DeviceManager {
return $this->loopdetection->ProcessLoopDetectionAddStatus($folderid, $status);
}
/**
* Announces that the current process is a push connection to the process loop
* detection and to the Top collector
*
* @access public
* @return boolean
*/
public function AnnounceProcessAsPush() {
ZLog::Write(LOGLEVEL_DEBUG, "Announce process as PUSH connection");
return $this->loopdetection->ProcessLoopDetectionSetAsPush() && ZPush::GetTopCollector()->SetAsPushConnection();
}
/**
* Checks if the given counter for a certain uuid+folderid was already exported or modified.
* This is called when a heartbeat request found changes to make sure that the same
......@@ -670,7 +683,6 @@ class DeviceManager {
return true;
}
/**
* Indicates if the device needs an AS version update
*
......
......@@ -178,6 +178,20 @@ class LoopDetection extends InterProcessData {
return true;
}
/**
* Marks the current process as a PUSH connection
*
* @access public
* @return boolean
*/
public function ProcessLoopDetectionSetAsPush() {
// generate entry if not already there
self::GetProcessEntry();
self::$processentry['push'] = true;
return $this->updateProcessStack();
}
/**
* Indicates if a full Hierarchy Resync is necessary
*
......@@ -255,7 +269,7 @@ class LoopDetection extends InterProcessData {
$stack = $this->getProcessStack();
if (count($stack) > 1) {
$se = $stack[0];
if (!isset($se['end']) && $se['cc'] != ZPush::COMMAND_PING) {
if (!isset($se['end']) && $se['cc'] != ZPush::COMMAND_PING && !isset($se['push']) ) {
// there is no end time
ZLog::Write(LOGLEVEL_ERROR, sprintf("LoopDetection->ProcessLoopDetectionPreviousConnectionFailed(): Command '%s' at %s with pid '%d' terminated unexpectedly or is still running.", Utils::GetCommandFromCode($se['cc']), Utils::GetFormattedTime($se['time']), $se['pid']));
ZLog::Write(LOGLEVEL_ERROR, "Please check your logs for this PID and errors like PHP-Fatals or Apache segmentation faults and report your results to the Z-Push dev team.");
......
......@@ -411,7 +411,7 @@ class SyncCollections implements Iterator {
$this->changes = array();
$changesAvailable = false;
ZPush::GetTopCollector()->SetAsPushConnection();
ZPush::GetDeviceManager()->AnnounceProcessAsPush();
ZPush::GetTopCollector()->AnnounceInformation(sprintf("lifetime %ds", $lifetime), true);
ZLog::Write(LOGLEVEL_INFO, sprintf("SyncCollections->CheckForChanges(): Waiting for %s changes... (lifetime %d seconds)", (empty($classes))?'policy':'store', $lifetime));
......
......@@ -244,6 +244,7 @@ class TopCollector extends InterProcessData {
*/
public function SetUserAgent($agent) {
$this->latest["devagent"] = $agent;
return true;
}
/**
......@@ -256,6 +257,7 @@ class TopCollector extends InterProcessData {
*/
public function SetAsPushConnection() {
$this->latest["push"] = true;
return true;
}
/**
......
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