From cbe3aeacc616bb8e3140bfa504eea3933525af63 Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Tue, 9 Jun 2015 08:29:52 +0000 Subject: 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 --- qpid/python/qpid/peer.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'qpid/python') 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): -- cgit v1.2.1