From 0e5c81c2e02e49e2425085fcaefcaf90f1fc68fd Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sat, 19 Jan 2008 23:33:09 +0000 Subject: [PATCH] Handle losing contact with the daemon gracefully. --- deluge/ui/client.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/deluge/ui/client.py b/deluge/ui/client.py index 536e6dcd7..4e0842e89 100644 --- a/deluge/ui/client.py +++ b/deluge/ui/client.py @@ -155,16 +155,21 @@ class CoreProxy(gobject.GObject): return True if self._multi is not None: - for i, ret in enumerate(self._multi()): - try: - if block == False: - gobject.idle_add(self._callbacks[i], ret) - else: - self._callbacks[i](ret) - except: - pass - - self._callbacks = [] + try: + for i, ret in enumerate(self._multi()): + try: + if block == False: + gobject.idle_add(self._callbacks[i], ret) + else: + self._callbacks[i](ret) + except: + pass + except socket.error, e: + log.warning("Could not contact daemon: %s", e) + self.set_core_uri(None) + finally: + self._callbacks = [] + self._multi = xmlrpclib.MultiCall(self._core) return True