summaryrefslogtreecommitdiff
path: root/lib/ext/Syncroton/Command/Ping.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ext/Syncroton/Command/Ping.php')
-rw-r--r--lib/ext/Syncroton/Command/Ping.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/ext/Syncroton/Command/Ping.php b/lib/ext/Syncroton/Command/Ping.php
index d2e5c83..a2bd926 100644
--- a/lib/ext/Syncroton/Command/Ping.php
+++ b/lib/ext/Syncroton/Command/Ping.php
@@ -57,8 +57,8 @@ class Syncroton_Command_Ping extends Syncroton_Command_Wbxml
$xml = simplexml_import_dom($this->_requestBody);
$xml->registerXPathNamespace('Ping', 'Ping');
- if(isset($xml->HeartBeatInterval)) {
- $this->_device->pinglifetime = (int)$xml->HeartBeatInterval;
+ if(isset($xml->HeartbeatInterval)) {
+ $this->_device->pinglifetime = (int)$xml->HeartbeatInterval;
}
if (isset($xml->Folders->Folder)) {
@@ -86,8 +86,15 @@ class Syncroton_Command_Ping extends Syncroton_Command_Wbxml
$this->_device = $this->_deviceBackend->update($this->_device);
}
- $lifeTime = $this->_device->pinglifetime;
- #Tinebase_Core::setExecutionLifeTime($lifeTime);
+ $lifeTime = $this->_device->pinglifetime;
+ $maxLifeTime = Syncroton_Registry::getPingInterval();
+
+ if ($maxLifeTime > 0 && $lifeTime > $maxLifeTime) {
+ $ping = $this->_outputDom->documentElement;
+ $ping->appendChild($this->_outputDom->createElementNS('uri:Ping', 'Status', self::STATUS_INTERVAL_TO_GREAT_OR_SMALL));
+ $ping->appendChild($this->_outputDom->createElementNS('uri:Ping', 'HeartbeatInterval', $maxLifeTime));
+ return;
+ }
$intervalEnd = $intervalStart + $lifeTime;
$secondsLeft = $intervalEnd;