Repository: qpid-proton
Updated Branches:
  refs/heads/master 8154edf9c -> 3a48863c1


PROTON-1006: prevent waiting for a condition that can never be reached


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/3a48863c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/3a48863c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/3a48863c

Branch: refs/heads/master
Commit: 3a48863c1f9b1f148ceecf23bf53f231bd97b1d8
Parents: 8154edf
Author: Gordon Sim <[email protected]>
Authored: Tue Sep 29 17:26:08 2015 +0100
Committer: Gordon Sim <[email protected]>
Committed: Tue Sep 29 17:26:17 2015 +0100

----------------------------------------------------------------------
 proton-c/bindings/python/proton/utils.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/3a48863c/proton-c/bindings/python/proton/utils.py
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/proton/utils.py 
b/proton-c/bindings/python/proton/utils.py
index d3ffeff..acc4c34 100644
--- a/proton-c/bindings/python/proton/utils.py
+++ b/proton-c/bindings/python/proton/utils.py
@@ -18,7 +18,7 @@
 #
 import collections, socket, time, threading
 
-from proton import ConnectionException, Delivery, Endpoint, Handler, 
LinkException, Message
+from proton import ConnectionException, Delivery, Endpoint, Handler, Link, 
LinkException, Message
 from proton import ProtonException, Timeout, Url
 from proton.reactor import Container
 from proton.handlers import MessagingHandler, IncomingMessageHandler
@@ -58,6 +58,9 @@ class SendException(ProtonException):
     def __init__(self, state):
         self.state = state
 
+def _is_settled(delivery):
+    return delivery.settled or delivery.link.snd_settle_mode == 
Link.SND_SETTLED
+
 class BlockingSender(BlockingLink):
     def __init__(self, connection, sender):
         super(BlockingSender, self).__init__(connection, sender)
@@ -70,7 +73,7 @@ class BlockingSender(BlockingLink):
 
     def send(self, msg, timeout=False, error_states=None):
         delivery = self.link.send(msg)
-        self.connection.wait(lambda: delivery.settled, msg="Sending on sender 
%s" % self.link.name, timeout=timeout)
+        self.connection.wait(lambda: _is_settled(delivery), msg="Sending on 
sender %s" % self.link.name, timeout=timeout)
         bad = error_states
         if bad is None:
             bad = [Delivery.REJECTED, Delivery.RELEASED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to