[CalendarServer-changes] [2969] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Wed Sep 10 09:54:38 PDT 2008
Revision: 2969
http://trac.macosforge.org/projects/calendarserver/changeset/2969
Author: sagen at apple.com
Date: 2008-09-10 09:54:37 -0700 (Wed, 10 Sep 2008)
Log Message:
-----------
Adds heartbeat rate (in minutes) to xmpp-heartbeat DAV property
Modified Paths:
--------------
CalendarServer/trunk/conf/caldavd-test.plist
CalendarServer/trunk/conf/caldavd.plist
CalendarServer/trunk/twistedcaldav/config.py
CalendarServer/trunk/twistedcaldav/customxml.py
CalendarServer/trunk/twistedcaldav/notify.py
CalendarServer/trunk/twistedcaldav/static.py
CalendarServer/trunk/twistedcaldav/test/test_notify.py
Modified: CalendarServer/trunk/conf/caldavd-test.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test.plist 2008-09-10 02:39:18 UTC (rev 2968)
+++ CalendarServer/trunk/conf/caldavd-test.plist 2008-09-10 16:54:37 UTC (rev 2969)
@@ -541,8 +541,8 @@
<integer>120</integer>
<!-- Sends a pubsub publish to a particular heartbeat node at this interval -->
- <key>HeartbeatSeconds</key>
- <integer>1800</integer>
+ <key>HeartbeatMinutes</key>
+ <integer>30</integer>
<!-- List of glob-like expressions defining which XMPP JIDs can converse with the server -->
<key>AllowedJIDs</key>
Modified: CalendarServer/trunk/conf/caldavd.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd.plist 2008-09-10 02:39:18 UTC (rev 2968)
+++ CalendarServer/trunk/conf/caldavd.plist 2008-09-10 16:54:37 UTC (rev 2969)
@@ -320,8 +320,8 @@
<integer>120</integer>
<!-- Sends a pubsub publish to a particular heartbeat node at this interval -->
- <key>HeartbeatSeconds</key>
- <integer>1800</integer>
+ <key>HeartbeatMinutes</key>
+ <integer>30</integer>
</dict>
</array>
</dict>
Modified: CalendarServer/trunk/twistedcaldav/config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/config.py 2008-09-10 02:39:18 UTC (rev 2968)
+++ CalendarServer/trunk/twistedcaldav/config.py 2008-09-10 16:54:37 UTC (rev 2969)
@@ -253,7 +253,7 @@
"Password" : "",
"ServiceAddress" : "", # "pubsub.xmpp.host.name"
"KeepAliveSeconds" : 120,
- "HeartbeatSeconds" : 1800, # 30 minute pubsub heartbeat
+ "HeartbeatMinutes" : 30,
"AllowedJIDs": [],
},
]
Modified: CalendarServer/trunk/twistedcaldav/customxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/customxml.py 2008-09-10 02:39:18 UTC (rev 2968)
+++ CalendarServer/trunk/twistedcaldav/customxml.py 2008-09-10 16:54:37 UTC (rev 2969)
@@ -254,16 +254,32 @@
protected = True
hidden = True
-class PubSubHeartbeatURIProperty (davxml.WebDAVTextElement):
+class PubSubHeartbeatProperty (davxml.WebDAVElement):
"""
A calendarhomefile property to indicate the pubsub XMPP URI to subscribe to
for server heartbeats.
"""
namespace = calendarserver_namespace
+ name = "xmpp-heartbeat"
+ protected = True
+ hidden = True
+ allowed_children = {
+ (calendarserver_namespace, "xmpp-heartbeat-uri" ) : (1, 1),
+ (calendarserver_namespace, "xmpp-heartbeat-minutes" ) : (1, 1),
+ }
+
+class PubSubHeartbeatURIProperty (davxml.WebDAVTextElement):
+ namespace = calendarserver_namespace
name = "xmpp-heartbeat-uri"
protected = True
hidden = True
+class PubSubHeartbeatMinutesProperty (davxml.WebDAVTextElement):
+ namespace = calendarserver_namespace
+ name = "xmpp-heartbeat-minutes"
+ protected = True
+ hidden = True
+
class PubSubXMPPServerProperty (davxml.WebDAVTextElement):
"""
A calendarhomefile property to indicate the pubsub XMPP hostname to
Modified: CalendarServer/trunk/twistedcaldav/notify.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/notify.py 2008-09-10 02:39:18 UTC (rev 2968)
+++ CalendarServer/trunk/twistedcaldav/notify.py 2008-09-10 16:54:37 UTC (rev 2969)
@@ -607,7 +607,7 @@
def sendHeartbeat(self):
if self.doHeartbeat and self.xmlStream is not None:
self.enqueue("update", "", lock=False)
- self.reactor.callLater(self.settings['HeartbeatSeconds'],
+ self.reactor.callLater(self.settings['HeartbeatMinutes'] * 60,
self.sendHeartbeat)
def enqueue(self, op, uri, lock=True):
@@ -1103,6 +1103,7 @@
results['host'] = config.ServerHostName
results['port'] = config.SSLPort or config.HTTPPort
results['xmpp-server'] = settings['Host']
+ results['heartrate'] = settings['HeartbeatMinutes']
return results
Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py 2008-09-10 02:39:18 UTC (rev 2968)
+++ CalendarServer/trunk/twistedcaldav/static.py 2008-09-10 16:54:37 UTC (rev 2969)
@@ -697,8 +697,16 @@
elif qname == (customxml.calendarserver_namespace, "xmpp-heartbeat-uri"):
pubSubConfiguration = getPubSubConfiguration(config)
if pubSubConfiguration['enabled']:
- return succeed(customxml.PubSubHeartbeatURIProperty(
- getPubSubHeartbeatURI(pubSubConfiguration)))
+ return succeed(
+ customxml.PubSubHeartbeatProperty(
+ customxml.PubSubHeartbeatURIProperty(
+ getPubSubHeartbeatURI(pubSubConfiguration)
+ ),
+ customxml.PubSubHeartbeatMinutesProperty(
+ str(pubSubConfiguration['heartrate'])
+ )
+ )
+ )
else:
return succeed(customxml.PubSubHeartbeatURIProperty())
Modified: CalendarServer/trunk/twistedcaldav/test/test_notify.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_notify.py 2008-09-10 02:39:18 UTC (rev 2968)
+++ CalendarServer/trunk/twistedcaldav/test/test_notify.py 2008-09-10 16:54:37 UTC (rev 2969)
@@ -478,7 +478,7 @@
xmlStream = StubXmlStream()
settings = { 'ServiceAddress' : 'pubsub.example.com', 'JID' : 'jid',
'Password' : 'password', 'KeepAliveSeconds' : 5,
- 'HeartbeatSeconds' : 1800 }
+ 'HeartbeatMinutes' : 30 }
notifier = XMPPNotifier(settings, reactor=clock, heartbeat=True,
roster=False, configOverride=xmppConfig)
factory = XMPPNotificationFactory(notifier, settings, reactor=clock,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080910/8ee3a49e/attachment.html
More information about the calendarserver-changes
mailing list