qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject [16/50] [abbrv] qpid-dispatch git commit: DISPATCH-179 - Fixed propagation of disposition and settlement across link-routes
Date Fri, 18 Mar 2016 23:06:34 GMT
DISPATCH-179 - Fixed propagation of disposition and settlement across link-routes


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

Branch: refs/heads/master
Commit: 9d0a8e65192e4af4f45e7555dfbd3fd26ef3c328
Parents: bb14ecf
Author: Ted Ross <tross@redhat.com>
Authored: Tue Mar 8 13:40:26 2016 -0500
Committer: Ted Ross <tross@redhat.com>
Committed: Tue Mar 8 13:40:26 2016 -0500

----------------------------------------------------------------------
 src/container.c               |  7 +------
 src/router_core/connections.c |  6 +++++-
 src/router_core/transfer.c    |  6 ++++--
 src/router_node.c             | 20 ++++++++++++++------
 4 files changed, 24 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/9d0a8e65/src/container.c
----------------------------------------------------------------------
diff --git a/src/container.c b/src/container.c
index 482f33b..f6083b3 100644
--- a/src/container.c
+++ b/src/container.c
@@ -432,12 +432,7 @@ int pn_event_handler(void *handler_context, void *conn_context, pn_event_t
*even
             qd_detach_type_t dt = pn_event_type(event) == PN_LINK_REMOTE_CLOSE ? QD_CLOSED
: QD_DETACHED;
             if (node)
                 node->ntype->link_detach_handler(node->context, qd_link, dt);
-
-            //
-            // If the qd_link does not reference the pn_link, we have already freed the pn_link.
-            // If we attempt to free it again, proton will crash.
-            //
-            if (qd_link->pn_link == pn_link)
+            else if (qd_link->pn_link == pn_link)
                 pn_link_close(pn_link);
         }
         break;

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/9d0a8e65/src/router_core/connections.c
----------------------------------------------------------------------
diff --git a/src/router_core/connections.c b/src/router_core/connections.c
index ab8f6e1..fffa4d3 100644
--- a/src/router_core/connections.c
+++ b/src/router_core/connections.c
@@ -1031,7 +1031,7 @@ static void qdr_link_inbound_detach_CT(qdr_core_t *core, qdr_action_t
*action, b
 
     qdr_connection_t *conn      = action->args.connection.conn;
     qdr_link_t       *link      = action->args.connection.link;
-    //qdr_error_t      *error     = action->args.connection.error;
+    qdr_error_t      *error     = action->args.connection.error;
     qd_detach_type_t  dt        = action->args.connection.dt;
     qdr_address_t    *addr      = link->owning_addr;
     bool              was_local = false;
@@ -1039,6 +1039,10 @@ static void qdr_link_inbound_detach_CT(qdr_core_t *core, qdr_action_t
*action, b
     //
     // TODO - For routed links, propagate the detach
     //
+    if (link->connected_link) {
+        qdr_link_outbound_detach_CT(core, link->connected_link, error, QDR_CONDITION_NONE);
+        return;
+    }
 
     link->owning_addr = 0;
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/9d0a8e65/src/router_core/transfer.c
----------------------------------------------------------------------
diff --git a/src/router_core/transfer.c b/src/router_core/transfer.c
index 9484489..b05f15a 100644
--- a/src/router_core/transfer.c
+++ b/src/router_core/transfer.c
@@ -431,6 +431,8 @@ static void qdr_update_delivery_CT(qdr_core_t *core, qdr_action_t *action,
bool
     uint64_t        disp    = action->args.delivery.disposition;
     bool            settled = action->args.delivery.settled;
 
+    bool link_routed = dlv && dlv->link && dlv->link->connected_link;
+
     //
     // Logic:
     //
@@ -457,7 +459,7 @@ static void qdr_update_delivery_CT(qdr_core_t *core, qdr_action_t *action,
bool
             push = true;
             peer->peer = 0;
             dlv->peer  = 0;
-            if (peer->link) {
+            if (peer->link && !link_routed) {
                 sys_mutex_lock(peer->link->conn->work_lock);
                 DEQ_REMOVE(peer->link->unsettled, peer);
                 sys_mutex_unlock(peer->link->conn->work_lock);
@@ -466,7 +468,7 @@ static void qdr_update_delivery_CT(qdr_core_t *core, qdr_action_t *action,
bool
             }
         }
 
-        if (dlv->link) {
+        if (dlv->link && !link_routed) {
             sys_mutex_lock(dlv->link->conn->work_lock);
             DEQ_REMOVE(dlv->link->unsettled, dlv);
             sys_mutex_unlock(dlv->link->conn->work_lock);

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/9d0a8e65/src/router_node.c
----------------------------------------------------------------------
diff --git a/src/router_node.c b/src/router_node.c
index 27b54c0..100e204 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -187,10 +187,11 @@ static qd_field_iterator_t *router_annotate_message(qd_router_t    
  *router,
  */
 static void router_rx_handler(void* context, qd_link_t *link, pn_delivery_t *pnd)
 {
-    qd_router_t  *router  = (qd_router_t*) context;
-    pn_link_t    *pn_link = qd_link_pn(link);
-    qdr_link_t   *rlink   = (qdr_link_t*) qd_link_get_context(link);
-    qd_message_t *msg;
+    qd_router_t    *router   = (qd_router_t*) context;
+    pn_link_t      *pn_link  = qd_link_pn(link);
+    qdr_link_t     *rlink    = (qdr_link_t*) qd_link_get_context(link);
+    qdr_delivery_t *delivery = 0;
+    qd_message_t   *msg;
 
     //
     // Receive the message into a local representation.  If the returned message
@@ -222,7 +223,15 @@ static void router_rx_handler(void* context, qd_link_t *link, pn_delivery_t
*pnd
     // Handle the link-routed case
     //
     if (qdr_link_is_routed(rlink)) {
-        qdr_link_deliver_to_routed_link(rlink, msg, pn_delivery_settled(pnd));
+        delivery = qdr_link_deliver_to_routed_link(rlink, msg, pn_delivery_settled(pnd));
+        if (delivery) {
+            if (pn_delivery_settled(pnd))
+                pn_delivery_settle(pnd);
+            else {
+                pn_delivery_set_context(pnd, delivery);
+                qdr_delivery_set_context(delivery, pnd);
+            }
+        }
         return;
     }
 
@@ -242,7 +251,6 @@ static void router_rx_handler(void* context, qd_link_t *link, pn_delivery_t
*pnd
     //
     qd_message_depth_t  validation_depth = anonymous_link ? QD_DEPTH_PROPERTIES : QD_DEPTH_MESSAGE_ANNOTATIONS;
     bool                valid_message    = qd_message_check(msg, validation_depth);
-    qdr_delivery_t     *delivery         = 0;
 
     if (valid_message) {
         qd_parsed_field_t   *in_ma        = qd_message_message_annotations(msg);


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


Mime
View raw message