[CalendarServer-changes] [11641] CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2 /test/test_metafd.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Aug 26 10:39:06 PDT 2013


Revision: 11641
          http://trac.calendarserver.org//changeset/11641
Author:   glyph at apple.com
Date:     2013-08-26 10:39:06 -0700 (Mon, 26 Aug 2013)
Log Message:
-----------
Test for filling up slots without acknowledgement.

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2/test/test_metafd.py

Modified: CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2/test/test_metafd.py
===================================================================
--- CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2/test/test_metafd.py	2013-08-26 17:33:22 UTC (rev 11640)
+++ CalendarServer/branches/users/glyph/enforce-max-requests/twext/web2/test/test_metafd.py	2013-08-26 17:39:06 UTC (rev 11641)
@@ -180,7 +180,19 @@
         self.assertEquals(builder.port.reading, True)
 
 
+    def test_processStopsReadingEvenWhenConnectionsAreNotAcknowledged(self):
+        """
+        L{ConnectionLimiter.statusesChanged} determines whether the current
+        number of outstanding requests is above the limit.
+        """
+        builder = LimiterBuilder(self)
+        builder.fillUp(acknowledged=False)
+        self.assertEquals(builder.port.reading, False)
+        builder.processRestart()
+        self.assertEquals(builder.port.reading, True)
 
+
+
 class LimiterBuilder(object):
     """
     A L{LimiterBuilder} can build a L{ConnectionLimiter} and associated objects
@@ -220,15 +232,20 @@
         return serverServiceMaker
 
 
-    def fillUp(self):
+    def fillUp(self, acknowledged=True):
         """
         Fill up all the slots on the connection limiter.
+
+        @param acknowledged: Should the virtual connections created by this
+            method send a message back to the dispatcher indicating that the
+            subprocess has acknowledged receipt of the file descriptor?
         """
         for x in range(self.limiter.maxRequests):
             self.dispatcher.sendFileDescriptor(None, "SSL")
-            self.dispatcher.statusMessage(
-                self.dispatcher._subprocessSockets[0], "+"
-            )
+            if acknowledged:
+                self.dispatcher.statusMessage(
+                    self.dispatcher._subprocessSockets[0], "+"
+                )
 
 
     def processRestart(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130826/02e9182b/attachment-0001.html>


More information about the calendarserver-changes mailing list