From 2ebccc4f3ab6e7813ac2179c8318163ffdd22cff Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Fri, 9 May 2008 18:40:13 +0000 Subject: QPID-1045: always notify incoming message queues of session closure and provide API for notifying listeners of closure; also preserve connection close code and report in errors git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@654907 13f79535-47bb-0310-9956-ffa450edef68 --- python/qpid/delegates.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'python/qpid/delegates.py') diff --git a/python/qpid/delegates.py b/python/qpid/delegates.py index cdff132219..6e6b55e36a 100644 --- a/python/qpid/delegates.py +++ b/python/qpid/delegates.py @@ -50,6 +50,7 @@ class Delegate: ssn.received(seg) def connection_close(self, ch, close): + self.connection.close_code = (close.reply_code, close.reply_text) ch.connection_close_ok() self.connection.sock.close() if not self.connection.opened: @@ -73,13 +74,11 @@ class Delegate: notify(ch.session.condition) def session_detach(self, ch, d): - self.connection.detach(d.name, ch) + ssn = self.connection.detach(d.name, ch) ch.session_detached(d.name) def session_detached(self, ch, d): - ssn = self.connection.detach(d.name, ch) - if ssn is not None: - notify(ch.session.condition) + self.connection.detach(d.name, ch) def session_command_point(self, ch, cp): ssn = ch.session @@ -127,11 +126,11 @@ class Client(Delegate): "version": "development", "platform": os.name} - def __init__(self, connection, args={}): - Delegate.__init__(self, connection) - self.username = args.get('username', 'guest') - self.password = args.get('password', 'guest') - self.mechanism = args.get('mechanism', 'PLAIN') + def __init__(self, connection, username="guest", password="guest", mechanism="PLAIN"): + Delegate.__init__(self, connection) + self.username = username + self.password = password + self.mechanism = mechanism def start(self): self.connection.write_header(self.spec.major, self.spec.minor) -- cgit v1.2.1