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 2018/12/12 16:36:27 UTC

qpid-dispatch git commit: DISPATCH-1194 - On edge routers, check for local link-route destinations before making a lookup request.

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master a6134950e -> fafd1d618


DISPATCH-1194 - On edge routers, check for local link-route destinations before making a lookup request.


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

Branch: refs/heads/master
Commit: fafd1d618cd08f765f87a08f1682ddedc0d6bcc1
Parents: a613495
Author: Ted Ross <tr...@redhat.com>
Authored: Wed Dec 12 11:34:48 2018 -0500
Committer: Ted Ross <tr...@redhat.com>
Committed: Wed Dec 12 11:34:48 2018 -0500

----------------------------------------------------------------------
 .../address_lookup_client/lookup_client.c       | 36 +++++++++++++++-----
 1 file changed, 27 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/fafd1d61/src/router_core/modules/address_lookup_client/lookup_client.c
----------------------------------------------------------------------
diff --git a/src/router_core/modules/address_lookup_client/lookup_client.c b/src/router_core/modules/address_lookup_client/lookup_client.c
index 0eab118..483c3c2 100644
--- a/src/router_core/modules/address_lookup_client/lookup_client.c
+++ b/src/router_core/modules/address_lookup_client/lookup_client.c
@@ -471,6 +471,20 @@ static void qcm_addr_lookup_process_pending_requests_CT(qcm_lookup_client_t *cli
 }
 
 
+static bool qcm_terminus_has_local_link_route(qdr_core_t *core, qdr_connection_t *conn, qdr_terminus_t *terminus, qd_direction_t dir)
+{
+    qdr_address_t *addr;
+    qd_iterator_t *iter = qd_iterator_dup(qdr_terminus_get_address(terminus));
+    qd_iterator_reset_view(iter, ITER_VIEW_ADDRESS_WITH_SPACE);
+    if (conn->tenant_space)
+        qd_iterator_annotate_space(iter, conn->tenant_space, conn->tenant_space_len);
+    qd_parse_tree_retrieve_match(core->link_route_tree[dir], iter, (void**) &addr);
+    qd_iterator_free(iter);
+    return addr && (DEQ_SIZE(addr->conns) > 0);
+}
+
+
+
 //================================================================================
 // Address Lookup Handler
 //================================================================================
@@ -491,10 +505,11 @@ static void qcm_addr_lookup_CT(void             *context,
     if (client->core->router_mode == QD_ROUTER_MODE_EDGE
         && client->client_api_active
         && conn != client->edge_conn
-        && qdr_terminus_get_address(term) != 0) {
+        && qdr_terminus_get_address(term) != 0
+        && !qcm_terminus_has_local_link_route(client->core, conn, term, dir)) {
         //
-        // We are in edge mode, there is an active edge connection, and the terminus has an address.
-        // Set up and scehdule an asynchronous lookup request.
+        // We are in edge mode, there is an active edge connection, the terminus has an address,
+        // and there is no local link route for this address.  Set up the asynchronous lookup.
         //
         qcm_addr_lookup_request_t *request = new_qcm_addr_lookup_request_t();
         DEQ_ITEM_INIT(request);
@@ -506,13 +521,16 @@ static void qcm_addr_lookup_CT(void             *context,
 
         DEQ_INSERT_TAIL(client->pending_requests, request);
         qcm_addr_lookup_process_pending_requests_CT(client);
-    } else {
-        //
-        // If this lookup doesn't meet the criteria for asynchronous action, perform the built-in, synchronous address lookup
-        //
-        qdr_address_t *addr = qdr_lookup_terminus_address_CT(client->core, dir, conn, term, true, true, &link_route, &unavailable, &core_endpoint);
-        qdr_link_react_to_first_attach_CT(client->core, conn, addr, link, dir, source, target, link_route, unavailable, core_endpoint);
+        return;
     }
+
+    //
+    // If this lookup doesn't meet the criteria for asynchronous action, perform the built-in, synchronous address lookup
+    //
+    qdr_address_t *addr = qdr_lookup_terminus_address_CT(client->core, dir, conn, term, true, true,
+                                                         &link_route, &unavailable, &core_endpoint);
+    qdr_link_react_to_first_attach_CT(client->core, conn, addr, link, dir, source, target,
+                                      link_route, unavailable, core_endpoint);
 }
 
 


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