summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2015-06-09 08:29:52 +0000
committerKeith Wall <kwall@apache.org>2015-06-09 08:29:52 +0000
commit7fe188aed72ada1f77901fb54db837a503f6e0a1 (patch)
tree0e887e109178804a47e1348e9de0e12cf4c8465f /python
parentd29c49c70277384bd02900455ea3cc02c1c1748c (diff)
downloadqpid-python-7fe188aed72ada1f77901fb54db837a503f6e0a1.tar.gz
QPID-6567: [Python Client] Centralise responsibilities for flow_control_wait_condition lock used on the 08..091 path
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1684350 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
-rw-r--r--python/qpid/peer.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/python/qpid/peer.py b/python/qpid/peer.py
index 7b1faff190..fcad0f3ae6 100644
--- a/python/qpid/peer.py
+++ b/python/qpid/peer.py
@@ -348,9 +348,11 @@ class Channel:
if frame.method.klass.name == "basic" and frame.method.name == "publish":
self._flow_control_wait_condition.acquire()
- self.check_flow_control()
- self.write(frame, content)
- self._flow_control_wait_condition.release()
+ try:
+ self.check_flow_control()
+ self.write(frame, content)
+ finally:
+ self._flow_control_wait_condition.release()
else:
self.write(frame, content)
@@ -407,7 +409,6 @@ class Channel:
if self._flow_control:
self._flow_control_wait_condition.wait(self._flow_control_wait_failure)
if self._flow_control:
- self._flow_control_wait_condition.release()
raise Timeout("Unable to send message for " + str(self._flow_control_wait_failure) + " seconds due to broker enforced flow control")
def __getattr__(self, name):