[CalendarServer-changes] [12238] twext/trunk/twext/application/masterchild.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:19:56 PDT 2014


Revision: 12238
          http://trac.calendarserver.org//changeset/12238
Author:   wsanchez at apple.com
Date:     2014-01-03 16:36:39 -0800 (Fri, 03 Jan 2014)
Log Message:
-----------
Log when connections are made and lost.

Modified Paths:
--------------
    twext/trunk/twext/application/masterchild.py

Modified: twext/trunk/twext/application/masterchild.py
===================================================================
--- twext/trunk/twext/application/masterchild.py	2014-01-03 23:33:05 UTC (rev 12237)
+++ twext/trunk/twext/application/masterchild.py	2014-01-04 00:36:39 UTC (rev 12238)
@@ -632,24 +632,43 @@
 
 
 class ReportingProtocolWrapper(ProtocolWrapper, object):
-    log = Logger()
-
-
     def connectionLost(self, reason):
+        # self.factory.protocolDidLoseConnection(self)
         self.factory.inheritedPort.reportStatus("-")
         return super(ReportingProtocolWrapper, self).connectionLost(reason)
 
 
 
 class ReportingWrapperFactory(WrappingFactory, object):
+    log = Logger()
+
     protocol = ReportingProtocolWrapper
 
+
     def __init__(self, wrappedFactory, fd, createTransport):
         self.inheritedPort = InheritedPort(fd, createTransport, self)
         super(ReportingWrapperFactory, self).__init__(wrappedFactory)
 
 
+    def registerProtocol(self, p):
+        super(ReportingWrapperFactory, self).registerProtocol(p)
+        self.log.info(
+            "++++ Registered protocol: {protocol}\n"
+            "Remaining protocols: {factory.protocols}",
+            factory=self, protocol=p
+        )
 
+
+    def unregisterProtocol(self, p):
+        super(ReportingWrapperFactory, self).unregisterProtocol(p)
+        self.log.info(
+            "---- Unregistered protocol: {protocol}\n"
+            "Remaining protocols: {factory.protocols}",
+            factory=self, protocol=p
+        )
+
+
+
 @total_ordering
 class ChildStatus(FancyStrMixin, object):
     """
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/750f0f69/attachment.html>


More information about the calendarserver-changes mailing list