You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2018/10/24 13:54:20 UTC

qpid-dispatch git commit: DISPATCH-1153 - Make sure the size of the undelivered list in non-zero before deleting its head. A detach might have arrived in the meantime and cleaned out the undelivered list

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 267207d2b -> 6203bb927


DISPATCH-1153 - Make sure the size of the undelivered list in non-zero before deleting its head. A detach might have arrived in the meantime and cleaned out the undelivered list


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/6203bb92
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/6203bb92
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/6203bb92

Branch: refs/heads/master
Commit: 6203bb92786f4ec535dbd538cc1f98df26982373
Parents: 267207d
Author: Ganesh Murthy <gm...@redhat.com>
Authored: Wed Oct 24 09:54:02 2018 -0400
Committer: Ganesh Murthy <gm...@redhat.com>
Committed: Wed Oct 24 09:54:02 2018 -0400

----------------------------------------------------------------------
 src/router_core/transfer.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/6203bb92/src/router_core/transfer.c
----------------------------------------------------------------------
diff --git a/src/router_core/transfer.c b/src/router_core/transfer.c
index b011f5f..f3457fc 100644
--- a/src/router_core/transfer.c
+++ b/src/router_core/transfer.c
@@ -174,8 +174,19 @@ int qdr_link_process_deliveries(qdr_core_t *core, qdr_link_t *link, int credit)
                     // The entire message has been sent. It is now the appropriate time to have the delivery removed
                     // from the head of the undelivered list and move it to the unsettled list if it is not settled.
                     //
-                    DEQ_REMOVE_HEAD(link->undelivered);
                     num_deliveries_completed++;
+
+                    credit--;
+                    link->credit_to_core--;
+                    link->total_deliveries++;
+                    offer = DEQ_SIZE(link->undelivered);
+
+                    if (offer == 0) {
+                        sys_mutex_unlock(conn->work_lock);
+                        return num_deliveries_completed;
+                    }
+
+                    DEQ_REMOVE_HEAD(link->undelivered);
                     dlv->link_work = 0;
 
                     if (settled) {
@@ -186,11 +197,6 @@ int qdr_link_process_deliveries(qdr_core_t *core, qdr_link_t *link, int credit)
                         dlv->where = QDR_DELIVERY_IN_UNSETTLED;
                         qd_log(core->log, QD_LOG_DEBUG, "Delivery transfer:  dlv:%lx qdr_link_process_deliveries: undelivered-list -> unsettled-list", (long) dlv);
                     }
-
-                    credit--;
-                    link->credit_to_core--;
-                    link->total_deliveries++;
-                    offer = DEQ_SIZE(link->undelivered);
                 }
                 else {
                     //
@@ -228,7 +234,6 @@ int qdr_link_process_deliveries(qdr_core_t *core, qdr_link_t *link, int credit)
     return num_deliveries_completed;
 }
 
-
 void qdr_link_flow(qdr_core_t *core, qdr_link_t *link, int credit, bool drain_mode)
 {
     qdr_action_t *action = qdr_action(qdr_link_flow_CT, "link_flow");


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