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

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


The following commit(s) were added to refs/heads/master by this push:
     new b44882d  DISPATCH-1325 - Treat newly attached outgoing links as 
stalled since they have not yet received initial credit.  This will prevent 
stalling of deliveries that arrive before the link is fully attached. This 
closes #496
b44882d is described below

commit b44882d0ae7bccec818d0080d414d5ac6e36bb64
Author: Ted Ross <tr...@redhat.com>
AuthorDate: Wed May 1 14:02:32 2019 -0400

    DISPATCH-1325 - Treat newly attached outgoing links as stalled since they 
have not yet received initial credit.  This will prevent stalling of deliveries 
that arrive before the link is fully attached.
    This closes #496
---
 src/router_core/transfer.c |  8 +++++---
 src/router_node.c          | 12 ++++++++++++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/router_core/transfer.c b/src/router_core/transfer.c
index 17afa8d..f27cbf1 100644
--- a/src/router_core/transfer.c
+++ b/src/router_core/transfer.c
@@ -311,9 +311,11 @@ static void qdr_link_flow_CT(qdr_core_t *core, 
qdr_action_t *action, bool discar
     //
     if (link->stalled_outbound) {
         link->stalled_outbound = false;
-        // Adding this work at priority 0.
-        qdr_add_link_ref(link->conn->links_with_work, link, 
QDR_LINK_LIST_CLASS_WORK);
-        activate = true;
+        if (DEQ_SIZE(link->undelivered) > 0) {
+            // Adding this work at priority 0.
+            qdr_add_link_ref(link->conn->links_with_work, link, 
QDR_LINK_LIST_CLASS_WORK);
+            activate = true;
+        }
     }
 
     if (link->core_endpoint) {
diff --git a/src/router_node.c b/src/router_node.c
index f3c9966..ef4f3fe 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -1319,6 +1319,12 @@ static void CORE_link_first_attach(void             
*context,
     // Open (attach) the link
     //
     pn_link_open(qd_link_pn(qlink));
+
+    //
+    // Mark the link as stalled and waiting for initial credit.
+    //
+    if (qdr_link_direction(link) == QD_OUTGOING)
+        qdr_link_stalled_outbound(link);
 }
 
 
@@ -1335,6 +1341,12 @@ static void CORE_link_second_attach(void *context, 
qdr_link_t *link, qdr_terminu
     // Open (attach) the link
     //
     pn_link_open(qd_link_pn(qlink));
+
+    //
+    // Mark the link as stalled and waiting for initial credit.
+    //
+    if (qdr_link_direction(link) == QD_OUTGOING)
+        qdr_link_stalled_outbound(link);
 }
 
 static void CORE_close_connection(void *context, qdr_connection_t *qdr_conn, 
qdr_error_t *error)


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

Reply via email to