[CalendarServer-changes] [12877] CalendarServer/trunk/txweb2/metafd.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:08:45 PDT 2014


Revision: 12877
          http://trac.calendarserver.org//changeset/12877
Author:   cdaboo at apple.com
Date:     2014-03-12 11:08:45 -0700 (Wed, 12 Mar 2014)
Log Message:
-----------
Prevent exception when master is TERM'd.

Modified Paths:
--------------
    CalendarServer/trunk/txweb2/metafd.py

Modified: CalendarServer/trunk/txweb2/metafd.py
===================================================================
--- CalendarServer/trunk/txweb2/metafd.py	2014-03-12 18:07:51 UTC (rev 12876)
+++ CalendarServer/trunk/txweb2/metafd.py	2014-03-12 18:08:45 UTC (rev 12877)
@@ -446,8 +446,18 @@
         self.limiter = limiter
         self.maxAccepts = limiter.maxAccepts
         self.maxRequests = limiter.maxRequests
+        self.stopping = False
 
 
+    def stopFactory(self):
+        """
+        Mark this factory as being stopped to prevent attempts to start reading on its
+        port again when the limiter statuses change during shutdown.
+        """
+        super(LimitingInheritingProtocolFactory, self).stopFactory()
+        self.stopping = True
+
+
     def loadAboveMaximum(self):
         """
         The current server load has exceeded the maximum allowable.
@@ -457,9 +467,11 @@
 
     def loadNominal(self):
         """
-        The current server load is nominal; proceed with reading requests.
+        The current server load is nominal; proceed with reading requests (but only if
+        the server itself is still running).
         """
-        self.myServer.myPort.startReading()
+        if not self.stopping:
+            self.myServer.myPort.startReading()
 
 
     @property
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/c248e21e/attachment.html>


More information about the calendarserver-changes mailing list