[CalendarServer-changes] [2787] CalendarServer/branches/users/sagen/xmpp-2764/twistedcaldav/notify. py

source_changes at macosforge.org source_changes at macosforge.org
Fri Aug 8 10:12:21 PDT 2008


Revision: 2787
          http://trac.macosforge.org/projects/calendarserver/changeset/2787
Author:   sagen at apple.com
Date:     2008-08-08 10:12:20 -0700 (Fri, 08 Aug 2008)
Log Message:
-----------
Added 'hammer <count>' command to rapid-fire send the specified number of publish requests

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/xmpp-2764/twistedcaldav/notify.py

Modified: CalendarServer/branches/users/sagen/xmpp-2764/twistedcaldav/notify.py
===================================================================
--- CalendarServer/branches/users/sagen/xmpp-2764/twistedcaldav/notify.py	2008-08-07 23:50:45 UTC (rev 2786)
+++ CalendarServer/branches/users/sagen/xmpp-2764/twistedcaldav/notify.py	2008-08-08 17:12:20 UTC (rev 2787)
@@ -739,7 +739,7 @@
             if frm in self.roster:
                 txt = str(body).lower()
                 if txt == "help":
-                    response = "debug on, debug off, roster"
+                    response = "debug on, debug off, roster, hammer <count>"
                 elif txt == "roster":
                     response = "Roster: %s" % (str(self.roster),)
                 elif txt == "debug on":
@@ -748,6 +748,15 @@
                 elif txt == "debug off":
                     self.roster[frm]['debug'] = False
                     response = "Debugging off"
+                elif txt.startswith("hammer"):
+                    try:
+                        hammer, count = txt.split()
+                        count = int(count)
+                    except ValueError:
+                        response = "Please phrase it like 'hammer 100'"
+                    else:
+                        response = "Hammer will commence now, %d times" % (count,)
+                        self.reactor.callLater(1, self.hammer, count)
                 else:
                     response = "I don't understand.  Try 'help'."
             else:
@@ -760,6 +769,9 @@
                 self.xmlStream.send(message)
 
 
+    def hammer(self, count):
+        for i in xrange(count):
+            self.enqueue("hammertesting")
 
 
 class XMPPNotificationFactory(xmlstream.XmlStreamFactory, LoggingMixIn):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080808/5dc88562/attachment.html 


More information about the calendarserver-changes mailing list