You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2016/03/10 22:21:34 UTC

[1/2] qpid-dispatch git commit: DISPATCH_179 - Fixed propagation of seconds detach in routed links.

Repository: qpid-dispatch
Updated Branches:
  refs/heads/tross-DISPATCH-179-1 6b5067e7e -> 722b0eb79


DISPATCH_179 - Fixed propagation of seconds detach in routed links.


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

Branch: refs/heads/tross-DISPATCH-179-1
Commit: 2eee1098f2eeff10b778bebb481c817240dfbca6
Parents: 6b5067e
Author: Ted Ross <tr...@redhat.com>
Authored: Thu Mar 10 16:08:55 2016 -0500
Committer: Ted Ross <tr...@redhat.com>
Committed: Thu Mar 10 16:08:55 2016 -0500

----------------------------------------------------------------------
 src/container.c               |  8 +++++++-
 src/router_core/connections.c | 37 +++++++++++++++++++++++++------------
 src/router_core/forwarder.c   | 31 +++++++++++++++++++++++++------
 3 files changed, 57 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/2eee1098/src/container.c
----------------------------------------------------------------------
diff --git a/src/container.c b/src/container.c
index f6083b3..c63a077 100644
--- a/src/container.c
+++ b/src/container.c
@@ -434,6 +434,9 @@ int pn_event_handler(void *handler_context, void *conn_context, pn_event_t *even
                 node->ntype->link_detach_handler(node->context, qd_link, dt);
             else if (qd_link->pn_link == pn_link)
                 pn_link_close(pn_link);
+            if (qd_link->close_sess_with_link && qd_link->pn_sess &&
+                pn_link_state(pn_link) == (PN_LOCAL_CLOSED | PN_REMOTE_CLOSED))
+                pn_session_close(qd_link->pn_sess);
         }
         break;
 
@@ -874,8 +877,11 @@ void qd_link_close(qd_link_t *link)
 {
     if (link->pn_link)
         pn_link_close(link->pn_link);
-    if (link->close_sess_with_link && link->pn_sess)
+
+    if (link->close_sess_with_link && link->pn_sess &&
+        pn_link_state(link->pn_link) == (PN_LOCAL_CLOSED | PN_REMOTE_CLOSED)) {
         pn_session_close(link->pn_sess);
+    }
 }
 
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/2eee1098/src/router_core/connections.c
----------------------------------------------------------------------
diff --git a/src/router_core/connections.c b/src/router_core/connections.c
index fffa4d3..c0c28d9 100644
--- a/src/router_core/connections.c
+++ b/src/router_core/connections.c
@@ -416,6 +416,14 @@ static void qdr_link_cleanup_CT(qdr_core_t *core, qdr_connection_t *conn, qdr_li
     DEQ_REMOVE(core->open_links, link);
 
     //
+    // If the link has a connected peer, unlink the peer
+    //
+    if (link->connected_link) {
+        link->connected_link->connected_link = 0;
+        link->connected_link = 0;
+    }
+
+    //
     // Remove the reference to this link in the connection's reference lists
     //
     qdr_del_link_ref(&conn->links, link, QDR_LINK_LIST_CLASS_CONNECTION);
@@ -522,7 +530,7 @@ static char qdr_prefix_for_dir(qd_direction_t dir)
 }
 
 
-static qd_address_treatment_t qdr_treatment_for_address(qdr_core_t *core, qd_field_iterator_t *iter)
+static qd_address_treatment_t qdr_treatment_for_address_CT(qdr_core_t *core, qd_field_iterator_t *iter)
 {
     qdr_address_config_t *addr = 0;
 
@@ -672,8 +680,7 @@ static qdr_address_t *qdr_lookup_terminus_address_CT(qdr_core_t     *core,
     qd_address_iterator_override_prefix(iter, '\0'); // Cancel previous override
     qd_hash_retrieve(core->addr_hash, iter, (void**) &addr);
     if (!addr && create_if_not_found) {
-        qd_address_treatment_t sem = qdr_treatment_for_address(core, iter);
-        addr = qdr_address_CT(core, sem);
+        addr = qdr_address_CT(core, qdr_treatment_for_address_CT(core, iter));
         qd_hash_insert(core->addr_hash, iter, addr, &addr->hash_handle);
         DEQ_INSERT_TAIL(core->addrs, addr);
     }
@@ -793,6 +800,7 @@ static void qdr_link_inbound_first_attach_CT(qdr_core_t *core, qdr_action_t *act
     qd_direction_t     dir    = action->args.connection.dir;
     qdr_terminus_t    *source = action->args.connection.source;
     qdr_terminus_t    *target = action->args.connection.target;
+    bool               success;
 
     //
     // Put the link into the proper lists for tracking.
@@ -837,13 +845,18 @@ static void qdr_link_inbound_first_attach_CT(qdr_core_t *core, qdr_action_t *act
                     qdr_terminus_free(target);
                 }
 
-                else if (link_route)
+                else if (link_route) {
                     //
                     // This is a link-routed destination, forward the attach to the next hop
                     //
-                    qdr_forward_attach_CT(core, addr, link, source, target);
-
-                else {
+                    success = qdr_forward_attach_CT(core, addr, link, source, target);
+                    if (!success) {
+                        qdr_link_outbound_detach_CT(core, link, 0, QDR_CONDITION_NO_ROUTE_TO_DESTINATION);
+                        qdr_terminus_free(source);
+                        qdr_terminus_free(target);
+                    }
+
+                } else {
                     //
                     // Associate the link with the address.  With this association, it will be unnecessary
                     // to do an address lookup for deliveries that arrive on this link.
@@ -1037,6 +1050,11 @@ static void qdr_link_inbound_detach_CT(qdr_core_t *core, qdr_action_t *action, b
     bool              was_local = false;
 
     //
+    // Bump the detach count to track half and full detaches
+    //
+    link->detach_count++;
+
+    //
     // TODO - For routed links, propagate the detach
     //
     if (link->connected_link) {
@@ -1092,11 +1110,6 @@ static void qdr_link_inbound_detach_CT(qdr_core_t *core, qdr_action_t *action, b
         }
     }
 
-    //
-    // Bump the detach_count.  If it's now 1, the link is half-detached.  If it's 2,
-    // the link is fully detached.
-    //
-    link->detach_count++;
     if (link->detach_count == 1) {
         //
         // If the detach occurred via protocol, send a detach back.

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/2eee1098/src/router_core/forwarder.c
----------------------------------------------------------------------
diff --git a/src/router_core/forwarder.c b/src/router_core/forwarder.c
index 862c498..3bae3fd 100644
--- a/src/router_core/forwarder.c
+++ b/src/router_core/forwarder.c
@@ -49,6 +49,29 @@ struct qdr_forwarder_t {
 // Built-in Forwarders
 //==================================================================================
 
+static int qdr_forward_message_null_CT(qdr_core_t      *core,
+                                       qdr_address_t   *addr,
+                                       qd_message_t    *msg,
+                                       qdr_delivery_t  *in_delivery,
+                                       bool             exclude_inprocess,
+                                       bool             control,
+                                       qd_bitmask_t    *link_exclusion)
+{
+    qd_log(core->log, QD_LOG_CRITICAL, "NULL Message Forwarder Invoked");
+    return 0;
+}
+
+
+static bool qdr_forward_attach_null_CT(qdr_core_t     *core,
+                                       qdr_address_t  *addr,
+                                       qdr_link_t     *link,
+                                       qdr_terminus_t *source,
+                                       qdr_terminus_t *target)
+{
+    qd_log(core->log, QD_LOG_CRITICAL, "NULL Attach Forwarder Invoked");
+    return false;
+}
+
 
 qdr_delivery_t *qdr_forward_new_delivery_CT(qdr_core_t *core, qdr_delivery_t *peer, qdr_link_t *link, qd_message_t *msg)
 {
@@ -388,10 +411,6 @@ bool qdr_forward_link_balanced_CT(qdr_core_t     *core,
         }
     }
 
-    //
-    // TODO - Use the next-hop connection if there are no local containers.
-    //
-
     if (conn) {
         qdr_link_t *out_link = new_qdr_link_t();
         ZERO(out_link);
@@ -432,8 +451,8 @@ qdr_forwarder_t *qdr_new_forwarder(qdr_forward_message_t fm, qdr_forward_attach_
 {
     qdr_forwarder_t *forw = NEW(qdr_forwarder_t);
 
-    forw->forward_message      = fm;
-    forw->forward_attach       = fa;
+    forw->forward_message      = fm ? fm : qdr_forward_message_null_CT;
+    forw->forward_attach       = fa ? fa : qdr_forward_attach_null_CT;
     forw->bypass_valid_origins = bypass_valid_origins;
 
     return forw;


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


[2/2] qpid-dispatch git commit: DISPATCH-179 - Removed references to "label" in connectors/listeners. Use "name" instead.

Posted by tr...@apache.org.
DISPATCH-179 - Removed references to "label" in connectors/listeners.  Use "name" instead.


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

Branch: refs/heads/tross-DISPATCH-179-1
Commit: 722b0eb792d19d200ca57274522728e8e09682ff
Parents: 2eee109
Author: Ted Ross <tr...@redhat.com>
Authored: Thu Mar 10 16:20:45 2016 -0500
Committer: Ted Ross <tr...@redhat.com>
Committed: Thu Mar 10 16:20:45 2016 -0500

----------------------------------------------------------------------
 include/qpid/dispatch/server.h                |  4 ++--
 python/qpid_dispatch/management/qdrouter.json |  8 +-------
 src/connection_manager.c                      | 14 +++++++-------
 src/router_node.c                             | 10 +++++-----
 4 files changed, 15 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/722b0eb7/include/qpid/dispatch/server.h
----------------------------------------------------------------------
diff --git a/include/qpid/dispatch/server.h b/include/qpid/dispatch/server.h
index be9d117..e8d92b8 100644
--- a/include/qpid/dispatch/server.h
+++ b/include/qpid/dispatch/server.h
@@ -248,9 +248,9 @@ typedef struct qd_server_config_t {
     char *port;
 
     /**
-     * Connection label, used as a reference from other parts of the configuration.
+     * Connection name, used as a reference from other parts of the configuration.
      */
-    char *label;
+    char *name;
 
     /**
      * Space-separated list of SASL mechanisms to be accepted for the connection.

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/722b0eb7/python/qpid_dispatch/management/qdrouter.json
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch/management/qdrouter.json b/python/qpid_dispatch/management/qdrouter.json
index f558ee2..038b161 100644
--- a/python/qpid_dispatch/management/qdrouter.json
+++ b/python/qpid_dispatch/management/qdrouter.json
@@ -37,12 +37,6 @@
                     "default": "normal",
                     "description": "The role of an established connection. In the normal role, the connection is assumed to be used for AMQP clients that are doing normal message delivery over the connection.  In the inter-router role, the connection is assumed to be to another router in the network.  Inter-router discovery and routing protocols can only be used over inter-router connections.",
                     "create": true
-                },
-                "label": {
-                    "type": "string",
-                    "create": true,
-                    "required": false,
-                    "description": "When the role is 'route-container', this optional label may be used to identify connections for use in routes."
                 }
             }
         },
@@ -860,7 +854,7 @@
                 },
                 "connectors": {
                     "type": "string",
-                    "description": "Comma-separated list of labels associated with the connector leading to the target containers",
+                    "description": "Comma-separated list of names associated with the connector leading to the target containers",
                     "create": true,
                     "required": false
                 },

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/722b0eb7/src/connection_manager.c
----------------------------------------------------------------------
diff --git a/src/connection_manager.c b/src/connection_manager.c
index 31e2fad..794ddee 100644
--- a/src/connection_manager.c
+++ b/src/connection_manager.c
@@ -79,7 +79,7 @@ static void qd_server_config_free(qd_server_config_t *cf)
     if (!cf) return;
     free(cf->host);
     free(cf->port);
-    free(cf->label);
+    free(cf->name);
     free(cf->role);
     free(cf->sasl_mechanisms);
     if (cf->ssl_enabled) {
@@ -141,7 +141,7 @@ static qd_error_t load_server_config(qd_dispatch_t *qd, qd_server_config_t *conf
     memset(config, 0, sizeof(*config));
     config->host            = qd_entity_get_string(entity, "addr"); CHECK();
     config->port            = qd_entity_get_string(entity, "port"); CHECK();
-    config->label           = qd_entity_opt_string(entity, "label", 0); CHECK();
+    config->name            = qd_entity_opt_string(entity, "name", 0); CHECK();
     config->role            = qd_entity_get_string(entity, "role"); CHECK();
     config->max_frame_size  = qd_entity_get_long(entity, "maxFrameSize"); CHECK();
     config->idle_timeout_seconds = qd_entity_get_long(entity, "idleTimeoutSeconds"); CHECK();
@@ -209,9 +209,9 @@ qd_error_t qd_dispatch_configure_connector(qd_dispatch_t *qd, qd_entity_t *entit
     DEQ_ITEM_INIT(cc);
     if (strcmp(cc->configuration.role, "route-container") == 0) {
         DEQ_INSERT_TAIL(cm->on_demand_connectors, cc);
-        qd_log(cm->log_source, QD_LOG_INFO, "Configured route-container connector: %s:%s label=%s",
+        qd_log(cm->log_source, QD_LOG_INFO, "Configured route-container connector: %s:%s name=%s",
                cc->configuration.host, cc->configuration.port,
-               cc->configuration.label ? cc->configuration.label : "<none>");
+               cc->configuration.name ? cc->configuration.name : "<none>");
     } else {
         DEQ_INSERT_TAIL(cm->config_connectors, cc);
         qd_log(cm->log_source, QD_LOG_INFO, "Configured Connector: %s:%s role=%s",
@@ -294,7 +294,7 @@ qd_config_connector_t *qd_connection_manager_find_on_demand(qd_dispatch_t *qd, c
     qd_config_connector_t *cc = DEQ_HEAD(qd->connection_manager->on_demand_connectors);
 
     while (cc) {
-        if (strcmp(cc->configuration.label, name) == 0)
+        if (strcmp(cc->configuration.name, name) == 0)
             break;
         cc = DEQ_NEXT(cc);
     }
@@ -320,7 +320,7 @@ void qd_connection_manager_start_on_demand(qd_dispatch_t *qd, qd_config_connecto
 {
     if (cc && cc->connector == 0) {
         qd_log(qd->connection_manager->log_source, QD_LOG_INFO, "Starting on-demand connector: %s",
-               cc->configuration.label);
+               cc->configuration.name);
         cc->connector = qd_server_connect(qd, &cc->configuration, cc);
     }
 }
@@ -345,7 +345,7 @@ void qd_config_connector_set_context(qd_config_connector_t *cc, void *context)
 
 const char *qd_config_connector_name(qd_config_connector_t *cc)
 {
-    return cc ? cc->configuration.label : 0;
+    return cc ? cc->configuration.name : 0;
 }
 
 

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/722b0eb7/src/router_node.c
----------------------------------------------------------------------
diff --git a/src/router_node.c b/src/router_node.c
index 100e204..5d70cb9 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -44,7 +44,7 @@ static char *node_id;
  */
 static void qd_router_connection_get_config(const qd_connection_t  *conn,
                                             qdr_connection_role_t  *role,
-                                            const char            **label,
+                                            const char            **name,
                                             bool                   *strip_annotations_in,
                                             bool                   *strip_annotations_out)
 {
@@ -64,7 +64,7 @@ static void qd_router_connection_get_config(const qd_connection_t  *conn,
         else
             *role = QDR_ROLE_NORMAL;
 
-        *label = cf->label;
+        *name = cf->name;
     }
 }
 
@@ -455,13 +455,13 @@ static void router_opened_handler(qd_router_t *router, qd_connection_t *conn, bo
     qdr_connection_role_t  role;
     bool                   strip_annotations_in;
     bool                   strip_annotations_out;
-    const char            *label;
+    const char            *name;
     pn_connection_t       *pn_conn = qd_connection_pn(conn);
 
-    qd_router_connection_get_config(conn, &role, &label,
+    qd_router_connection_get_config(conn, &role, &name,
                                     &strip_annotations_in, &strip_annotations_out);
 
-    qdr_connection_t *qdrc = qdr_connection_opened(router->router_core, inbound, role, label,
+    qdr_connection_t *qdrc = qdr_connection_opened(router->router_core, inbound, role, name,
                                                    pn_connection_remote_container(pn_conn),
                                                    strip_annotations_in, strip_annotations_out);
 


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