Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 802e4aa97 -> 7ff1f3237


DISPATCH-895 - Check if underlying proton links are not closed before calling 
into proton. The underlying links/sessions on a connection are cleaned up 
silently by proton when a connection drops.


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

Branch: refs/heads/master
Commit: 7ff1f32372b13f1de9073e7572f1200b167de852
Parents: 802e4aa
Author: Ganesh Murthy <gmur...@redhat.com>
Authored: Thu Dec 7 09:56:49 2017 -0500
Committer: Ganesh Murthy <gmur...@redhat.com>
Committed: Thu Dec 7 09:56:49 2017 -0500

----------------------------------------------------------------------
 src/router_node.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/7ff1f323/src/router_node.c
----------------------------------------------------------------------
diff --git a/src/router_node.c b/src/router_node.c
index a3a5934..08cafde 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -1406,6 +1406,10 @@ static void CORE_delivery_update(void *context, 
qdr_delivery_t *dlv, uint64_t di
     if (!pnd)
         return;
 
+    // If the delivery's link is somehow gone (maybe because of a connection 
drop, we don't proceed.
+    if (!pn_delivery_link(pnd))
+        return;
+
     qdr_error_t *error = qdr_delivery_error(dlv);
 
     if (error) {
@@ -1421,6 +1425,22 @@ static void CORE_delivery_update(void *context, 
qdr_delivery_t *dlv, uint64_t di
         free(description);
     }
 
+    qdr_link_t *qlink = qdr_delivery_link(dlv);
+    qd_link_t *link = 0;
+
+    if (qlink) {
+        link = (qd_link_t*) qdr_link_get_context(qlink);
+        if (link) {
+            qd_connection_t  *conn     = qd_link_connection(link);
+            if (conn == 0)
+                return;
+        }
+        else
+            return;
+    }
+    else
+        return;
+
     //
     // If the disposition has changed, update the proton delivery.
     //
@@ -1436,8 +1456,6 @@ static void CORE_delivery_update(void *context, 
qdr_delivery_t *dlv, uint64_t di
     // If the delivery is settled, remove the linkage and settle the proton 
delivery.
     //
     if (settled) {
-        qdr_link_t *qlink = qdr_delivery_link(dlv);
-        qd_link_t  *link  = (qd_link_t*) qdr_link_get_context(qlink);
         qdr_node_disconnect_deliveries(router->router_core, link, dlv, pnd);
         pn_delivery_settle(pnd);
     }


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

Reply via email to