From ba8e5b1129ebb83a601574f349db9701b1511809 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Wed, 3 Dec 2008 18:43:16 +0000 Subject: QPID-1512 - Catch only connection-related exceptions in qmf console connection thread - Added __hash__ method for UUID in qpid.datatypes git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@723008 13f79535-47bb-0310-9956-ffa450edef68 --- python/commands/qpid-config | 2 +- python/commands/qpid-route | 2 +- python/qmf/console.py | 15 +++++++++++---- python/qpid/datatypes.py | 3 +++ 4 files changed, 16 insertions(+), 6 deletions(-) (limited to 'python') diff --git a/python/commands/qpid-config b/python/commands/qpid-config index 6bfa6939f1..beec67c826 100755 --- a/python/commands/qpid-config +++ b/python/commands/qpid-config @@ -379,7 +379,7 @@ try: else: Usage () except Exception,e: - print "Failed:", e.args[0] + print "Failed:", e.args sys.exit(1) bm.Disconnect() diff --git a/python/commands/qpid-route b/python/commands/qpid-route index 5733c62a27..e0e655683a 100755 --- a/python/commands/qpid-route +++ b/python/commands/qpid-route @@ -508,7 +508,7 @@ try: Usage() except Exception,e: - print "Failed:", e.args[0] + print "Failed:", e.args sys.exit(1) rm.disconnect() diff --git a/python/qmf/console.py b/python/qmf/console.py index fe329db289..739ccb6b6b 100644 --- a/python/qmf/console.py +++ b/python/qmf/console.py @@ -1191,9 +1191,16 @@ class ManagedConnection(Thread): delay = self.DELAY_MIN finally: self.cv.release() - except: + except socket.error: + if delay < self.DELAY_MAX: + delay *= self.DELAY_FACTOR + except SessionDetached: if delay < self.DELAY_MAX: delay *= self.DELAY_FACTOR + except Closed: + if delay < self.DELAY_MAX: + delay *= self.DELAY_FACTOR + try: self.cv.acquire() self.cv.wait(delay) @@ -1332,13 +1339,13 @@ class Broker: except socket.error, e: self.error = "Socket Error %s - %s" % (e[0], e[1]) - raise Exception(self.error) + raise except Closed, e: self.error = "Connect Failed %d - %s" % (e[0], e[1]) - raise Exception(self.error) + raise except ConnectionFailed, e: self.error = "Connect Failed %d - %s" % (e[0], e[1]) - raise Exception(self.error) + raise def _updateAgent(self, obj): bankKey = (obj.brokerBank, obj.agentBank) diff --git a/python/qpid/datatypes.py b/python/qpid/datatypes.py index 38fc163dd9..eb1f86b0b0 100644 --- a/python/qpid/datatypes.py +++ b/python/qpid/datatypes.py @@ -297,6 +297,9 @@ class UUID: def __repr__(self): return "UUID(%r)" % str(self) + def __hash__(self): + return self.bytes.__hash__() + class timestamp(float): def __new__(cls, obj=None): -- cgit v1.2.1