qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject svn commit: r1547027 - in /qpid/proton/trunk: proton-c/bindings/python/proton.py proton-c/src/messenger/messenger.c tests/python/proton_tests/messenger.py
Date Mon, 02 Dec 2013 14:14:38 GMT
Author: rhs
Date: Mon Dec  2 14:14:38 2013
New Revision: 1547027

URL: http://svn.apache.org/r1547027
Log:
PROTON-290: applied updated patch from Bozo

Modified:
    qpid/proton/trunk/proton-c/bindings/python/proton.py
    qpid/proton/trunk/proton-c/src/messenger/messenger.c
    qpid/proton/trunk/tests/python/proton_tests/messenger.py

Modified: qpid/proton/trunk/proton-c/bindings/python/proton.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/python/proton.py?rev=1547027&r1=1547026&r2=1547027&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/python/proton.py (original)
+++ qpid/proton/trunk/proton-c/bindings/python/proton.py Mon Dec  2 14:14:38 2013
@@ -483,6 +483,18 @@ first message.
     disp = pn_messenger_status(self._mng, tracker);
     return STATUSES.get(disp, disp)
 
+  def buffered(self, tracker):
+    """
+    Checks if the delivery associated with the given tracker is still
+    waiting to be sent.
+
+    @type tracker: tracker
+    @param tracker: the tracker whose status is to be retrieved
+
+    @return true if delivery is still buffered
+    """
+    return pn_messenger_buffered(self._mng, tracker);
+
   def settle(self, tracker=None):
     """
     Frees a L{Messenger} from tracking the status associated with a given

Modified: qpid/proton/trunk/proton-c/src/messenger/messenger.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/messenger/messenger.c?rev=1547027&r1=1547026&r2=1547027&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/messenger/messenger.c (original)
+++ qpid/proton/trunk/proton-c/src/messenger/messenger.c Mon Dec  2 14:14:38 2013
@@ -1419,7 +1419,12 @@ bool pn_messenger_buffered(pn_messenger_
   pni_entry_t *e = pni_store_entry(store, pn_tracker_sequence(tracker));
   if (e) {
     pn_delivery_t *d = pni_entry_get_delivery(e);
-    return d && pn_delivery_buffered(d);
+    if (d) {
+      bool b = pn_delivery_buffered(d);
+      return b;
+    } else {
+      return true;
+    }
   } else {
     return false;
   }

Modified: qpid/proton/trunk/tests/python/proton_tests/messenger.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/messenger.py?rev=1547027&r1=1547026&r2=1547027&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/messenger.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/messenger.py Mon Dec  2 14:14:38 2013
@@ -332,6 +332,33 @@ class MessengerTest(Test):
   def testIncomingQueueBiggerThanSessionWindow(self):
     self.testIncomingQueueBiggerThanWindow(2048)
 
+  def testBuffered(self):
+    self.client.outgoing_window = 1000
+    self.client.incoming_window = 1000
+    self.start();
+    assert self.server_received == 0
+    buffering = 0
+    count = 100
+    for i in range(count):
+      msg = Message()
+      msg.address="amqp://0.0.0.0:12345"
+      msg.subject="Hello World!"
+      msg.body = "First the world, then the galaxy!"
+      t = self.client.put(msg)
+      buffered = self.client.buffered(t)
+      # allow transition from False to True, but not back
+      if buffered:
+          buffering += 1
+      else:
+        assert not buffering, ("saw %s buffered deliveries before?" % buffering)
+
+    while self.client.outgoing:
+        last = self.client.outgoing
+        self.client.send()
+        print "sent ", last - self.client.outgoing
+
+    assert self.server_received == count
+
   def test_proton222(self):
     self.start()
     msg = Message()



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message