summaryrefslogtreecommitdiff
path: root/qpid/python
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2015-04-03 16:57:34 +0000
committerKeith Wall <kwall@apache.org>2015-04-03 16:57:34 +0000
commita0b8db4140bcd82744060d5fb8ef6454967618af (patch)
tree52e03ca3f7117d27badec68f0946bbeb9141f42b /qpid/python
parent84c0701a097f25567a2c7192ae77510f17db7462 (diff)
downloadqpid-python-a0b8db4140bcd82744060d5fb8ef6454967618af.tar.gz
QPID-6475: [Python Client] 08..09 Send connection.close before closing socket
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1671100 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
-rw-r--r--qpid/python/qpid/client.py12
-rw-r--r--qpid/python/qpid/testlib.py5
2 files changed, 12 insertions, 5 deletions
diff --git a/qpid/python/qpid/client.py b/qpid/python/qpid/client.py
index 7ae0106b51..1bb225e7d1 100644
--- a/qpid/python/qpid/client.py
+++ b/qpid/python/qpid/client.py
@@ -127,7 +127,17 @@ class Client:
def close(self):
if self.peer:
- self.peer.stop()
+ try:
+ if not self.closed:
+ channel = self.channel(0);
+ if channel and not channel._closed:
+ try:
+ channel.connection_close(reply_code=200)
+ except:
+ pass
+ self.closed = True
+ finally:
+ self.peer.stop()
class ClientDelegate(Delegate):
diff --git a/qpid/python/qpid/testlib.py b/qpid/python/qpid/testlib.py
index 0103956ec4..841dcfbd88 100644
--- a/qpid/python/qpid/testlib.py
+++ b/qpid/python/qpid/testlib.py
@@ -71,10 +71,7 @@ class TestBase(unittest.TestCase):
print "Error on tearDown:"
print traceback.print_exc()
- if not self.client.closed:
- self.client.channel(0).connection_close(reply_code=200)
- else:
- self.client.close()
+ self.client.close()
def connect(self, host=None, port=None, user=None, password=None, tune_params=None, client_properties=None):
"""Create a new connction, return the Client object"""