summaryrefslogtreecommitdiff
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
commitcbe3aeacc616bb8e3140bfa504eea3933525af63 (patch)
tree3e8924b2e0bd36ff32597b3db452e37d8eed6ec8
parent2a347461803f54e39a9b4d41d68a47a06639a0a3 (diff)
downloadqpid-python-cbe3aeacc616bb8e3140bfa504eea3933525af63.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@1684350 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/python/qpid/peer.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/qpid/python/qpid/peer.py b/qpid/python/qpid/peer.py
index 7b1faff190..fcad0f3ae6 100644
--- a/qpid/python/qpid/peer.py
+++ b/qpid/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):