summaryrefslogtreecommitdiff
path: root/python/qpid/delegates.py
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2008-05-09 18:40:13 +0000
committerRafael H. Schloming <rhs@apache.org>2008-05-09 18:40:13 +0000
commit2ebccc4f3ab6e7813ac2179c8318163ffdd22cff (patch)
tree423197bb243ca909e90637fdc24c3a5a9565ad81 /python/qpid/delegates.py
parent7f0c95b0e94c964a92c77c7c8c59035ffff35f34 (diff)
downloadqpid-python-2ebccc4f3ab6e7813ac2179c8318163ffdd22cff.tar.gz
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
Diffstat (limited to 'python/qpid/delegates.py')
-rw-r--r--python/qpid/delegates.py17
1 files changed, 8 insertions, 9 deletions
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)