Add configuration switch for forcing the server heartbeat interval.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 24 Apr 2010 19:30:51 +0000 (15:30 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 24 Apr 2010 19:30:51 +0000 (15:30 -0400)
For those of us who don't like devices telling us what we have to do...allow
overriding the heartbeat interval so we can force it to be shorter then most
devices would request...useful for managing load on the server.

framework/ActiveSync/lib/Horde/ActiveSync/Request/Ping.php
horde/config/conf.xml

index c4ab8ed..cde1ff3 100644 (file)
@@ -42,6 +42,9 @@ class Horde_ActiveSync_Request_Ping extends Horde_ActiveSync_Request_Base
 
     protected function _checkHeartbeat($lifetime)
     {
+        if ($this->_ping_settings['forcedheartbeat']) {
+            return $this->_ping_settings['forcedheartbeat'];
+        }
         if ($lifetime !== 0 && $lifetime < $this->_ping_settings['heartbeatmin']) {
             $this->_statusCode = self::STATUS_HBOUTOFBOUNDS;
             $lifetime = $this->_ping_settings['heartbeatmin'];
index c7275dc..f0fd854 100644 (file)
       correctly. If you plan on synching Android devices, you should make sure
       that this range is wide enough to allow Android's default of 470 seconds.
       </configdescription>
-      <configinteger name="heartbeatmin" desc="The minimum number of seconds to
-      wait before sending results. This value must be greater then zero.">60
-      </configinteger>
-      <configinteger name="heartbeatmax" desc="The maximum number of seconds to
-      wait before sending results. Note this value must not be greater then 3540
-      (59 minutes).">2700</configinteger>
-      <configinteger name="heartbeatdefault" desc="If the client does not
-      request a heartbeat interval, this interval will be used by default.">480
-      </configinteger>
+      <configswitch name="deviceping" desc="Allow devices to manage the heartbeat or
+      force Horde to use a specific heartbeat for every device?">true
+       <case name="true" desc="Device managed heartbeat">
+        <configinteger name="heartbeatmin" desc="The minimum number of seconds to
+        wait before sending results. This value must be greater then zero.">60
+        </configinteger>
+        <configinteger name="heartbeatmax" desc="The maximum number of seconds to
+        wait before sending results. Note this value must not be greater then 3540
+        (59 minutes).">2700</configinteger>
+        <configinteger name="heartbeatdefault" desc="If the client does not
+        request a heartbeat interval, this interval will be used by default.">480
+        </configinteger>
+       </case>
+       <case name="false" desc="Forced heartbeat">
+        <configinteger name="forcedheartbeat" desc="The number of seconds to
+        force the server to wait before sending PING results.">60
+        </configinteger>
+       </case>
+      </configswitch>
       <configinteger name="waitinterval" desc="How many seconds should elapse
       between checks for changes? Increasing this value will cause the server
       to wait longer between checks for changes during the heartbeat,