[CalendarServer-changes] [13542] CalendarServer/trunk/txdav/dps/client.py

source_changes at macosforge.org source_changes at macosforge.org
Tue May 27 14:47:15 PDT 2014


Revision: 13542
          http://trac.calendarserver.org//changeset/13542
Author:   sagen at apple.com
Date:     2014-05-27 14:47:15 -0700 (Tue, 27 May 2014)
Log Message:
-----------
Forget our AMP connection object when we get an error so we'll reconnect next time.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/dps/client.py

Modified: CalendarServer/trunk/txdav/dps/client.py
===================================================================
--- CalendarServer/trunk/txdav/dps/client.py	2014-05-27 21:46:24 UTC (rev 13541)
+++ CalendarServer/trunk/txdav/dps/client.py	2014-05-27 21:47:15 UTC (rev 13542)
@@ -143,12 +143,9 @@
 
     @inlineCallbacks
     def _getConnection(self):
-        # TODO: reconnect if needed
 
-        # FIXME:
         from twistedcaldav.config import config
         path = config.DirectoryProxy.SocketPath
-        # path = "data/Logs/state/directory-proxy.sock"
         if getattr(self, "_connection", None) is None:
             log.debug("Creating connection")
             connection = (
@@ -176,7 +173,13 @@
         @type postProcess: callable
         """
         ampProto = (yield self._getConnection())
-        results = (yield ampProto.callRemote(command, **kwds))
+        try:
+            results = (yield ampProto.callRemote(command, **kwds))
+        except Exception, e:
+            log.error("Failed AMP command", error=e)
+            #  FIXME: is there a way to hook into ConnectionLost?
+            self._connection = None
+            raise
         returnValue(postProcess(results))
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140527/5fdd5070/attachment.html>


More information about the calendarserver-changes mailing list