qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [01/50] [abbrv] qpid-proton git commit: PROTON-1006: prevent waiting for a condition that can never be reached
Date Fri, 23 Oct 2015 14:36:03 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/go1 e57c2a524 -> e1a83ee25 (forced update)


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/go1
Commit: 3a48863c1f9b1f148ceecf23bf53f231bd97b1d8
Parents: 8154edf
Author: Gordon Sim <gsim@redhat.com>
Authored: Tue Sep 29 17:26:08 2015 +0100
Committer: Gordon Sim <gsim@redhat.com>
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: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message