This is an automated email from the ASF dual-hosted git repository.

gmurthy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/main by this push:
     new ee66bcc  DISPATCH-2047: Moved setting the deliveries_ingress to 
qdr_link_deliver_CT. Also fixed test to try the custom timer a few more times. 
This closes #1137.
ee66bcc is described below

commit ee66bcca2669ed2bb367d4021f6e75c98892eb6f
Author: Ganesh Murthy <gmur...@apache.org>
AuthorDate: Mon Apr 19 16:20:05 2021 -0400

    DISPATCH-2047: Moved setting the deliveries_ingress to qdr_link_deliver_CT. 
Also fixed test to try the custom timer a few more times. This closes #1137.
---
 src/router_core/transfer.c       |  9 +++------
 tests/system_tests_one_router.py | 23 ++++++++++++++++++-----
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/src/router_core/transfer.c b/src/router_core/transfer.c
index e7ed17d..917276c 100644
--- a/src/router_core/transfer.c
+++ b/src/router_core/transfer.c
@@ -516,9 +516,6 @@ static void qdr_link_forward_CT(qdr_core_t *core, 
qdr_link_t *link, qdr_delivery
     if (!dlv_link)
         return;
 
-    if (dlv_link->link_type == QD_LINK_ENDPOINT && !dlv_link->fallback)
-        core->deliveries_ingress++;
-
     if (addr
         && addr == link->owning_addr
         && qdr_addr_path_count_CT(addr) == 0
@@ -743,6 +740,9 @@ static void qdr_link_deliver_CT(qdr_core_t *core, 
qdr_action_t *action, bool dis
 
     link->total_deliveries++;
 
+    if (link->link_type == QD_LINK_ENDPOINT && !link->fallback)
+        core->deliveries_ingress++;
+
     //
     // Record the ingress time so we can track the age of this delivery.
     //
@@ -762,9 +762,6 @@ static void qdr_link_deliver_CT(qdr_core_t *core, 
qdr_action_t *action, bool dis
     }
 
     if (link->connected_link) {
-        if (link->link_direction == QD_INCOMING)
-            core->deliveries_ingress++;
-
         //
         // If this is an attach-routed link, put the delivery directly onto 
the peer link
         //
diff --git a/tests/system_tests_one_router.py b/tests/system_tests_one_router.py
index ff719b1..205dc0a 100644
--- a/tests/system_tests_one_router.py
+++ b/tests/system_tests_one_router.py
@@ -1465,8 +1465,10 @@ class PreSettled (MessagingHandler) :
 class PresettledCustomTimeout(object):
     def __init__(self, parent):
         self.parent = parent
+        self.num_tries = 0
 
     def on_timer_task(self, event):
+        self.num_tries += 1
         local_node = Node.connect(self.parent.addr, timeout=TIMEOUT)
         res = local_node.query('org.apache.qpid.dispatch.router')
         deliveries_ingress = res.attribute_names.index(
@@ -1486,10 +1488,13 @@ class PresettledCustomTimeout(object):
         if deliveries_ingress_diff + deliveries_dropped_diff > 
self.parent.n_messages:
             self.parent.bail(None)
         else:
-            self.parent.bail("Messages sent to the router is %d, "
-                             "Messages processed by the router is %d" %
-                             (self.parent.n_messages,
-                              deliveries_ingress_diff + 
deliveries_dropped_diff))
+            if self.num_tries == self.parent.max_tries:
+                self.parent.bail("Messages sent to the router is %d, "
+                                 "Messages processed by the router is %d" %
+                                 (self.parent.n_messages,
+                                  deliveries_ingress_diff + 
deliveries_dropped_diff))
+            else:
+                self.parent.schedule_timer()
 
 
 class DroppedPresettledTest(MessagingHandler):
@@ -1512,8 +1517,14 @@ class DroppedPresettledTest(MessagingHandler):
         self.begin_ingress_count = begin_ingress_count
         self.str1 = "0123456789abcdef"
         self.msg_str = ""
+        self.max_tries = 10
+        self.reactor = None
         for i in range(8192):
             self.msg_str += self.str1
+        self.timer_instance = PresettledCustomTimeout(self)
+
+    def schedule_timer(self):
+        self.custom_timer = self.reactor.schedule(0.5, self.timer_instance)
 
     def run(self):
         Container(self).run()
@@ -1524,12 +1535,14 @@ class DroppedPresettledTest(MessagingHandler):
         if self.recv_conn:
             self.recv_conn.close()
         self.timer.cancel()
+        self.custom_timer.cancel()
 
     def timeout(self,):
         self.bail("Timeout Expired: %d messages received, %d expected." %
                   (self.n_received, self.n_messages))
 
     def on_start(self, event):
+        self.reactor = event.reactor
         self.sender_conn = event.container.connect(self.addr)
         self.recv_conn = event.container.connect(self.addr)
         self.receiver = event.container.create_receiver(self.recv_conn,
@@ -1562,7 +1575,7 @@ class DroppedPresettledTest(MessagingHandler):
             # that the initial credit of 250 that the router gives.
             # Lets do a qdstat to find out if all 200 messages is handled
             # by the router.
-            self.custom_timer = event.reactor.schedule(1, 
PresettledCustomTimeout(self))
+            self.schedule_timer()
 
 
 class MulticastUnsettled (MessagingHandler) :

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

Reply via email to