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.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/ext/Syncroton/Command/Ping.php b/lib/ext/Syncroton/Command/Ping.php
index a2bd926..2e71fd2 100644
--- a/lib/ext/Syncroton/Command/Ping.php
+++ b/lib/ext/Syncroton/Command/Ping.php
@@ -87,12 +87,16 @@ class Syncroton_Command_Ping extends Syncroton_Command_Wbxml
}
$lifeTime = $this->_device->pinglifetime;
- $maxLifeTime = Syncroton_Registry::getPingInterval();
+ $maxInterval = Syncroton_Registry::getPingInterval();
- if ($maxLifeTime > 0 && $lifeTime > $maxLifeTime) {
+ if ($maxInterval <= 0 || $maxInterval > Syncroton_Server::MAX_HEARTBEAT_INTERVAL) {
+ $maxInterval = Syncroton_Server::MAX_HEARTBEAT_INTERVAL;
+ }
+
+ if ($lifeTime > $maxInterval) {
$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));
+ $ping->appendChild($this->_outputDom->createElementNS('uri:Ping', 'HeartbeatInterval', $maxInterval));
return;
}