qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject [2/3] qpid-dispatch git commit: DISPATCH-159 (not the fix) - Added an exact-match option for linkRoutePattern's prefix. This is a temporary extension that will eventually be superceded by the proper fix for this issue.
Date Tue, 08 Sep 2015 21:28:46 GMT
DISPATCH-159 (not the fix) - Added an exact-match option for linkRoutePattern's prefix.
    This is a temporary extension that will eventually be superceded by the proper fix for
this issue.


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

Branch: refs/heads/master
Commit: 0ed628f2ee74a93b16191719e8a96bbb7631e83d
Parents: 7c05e2f
Author: Ted Ross <tross@redhat.com>
Authored: Tue Sep 8 14:53:28 2015 -0400
Committer: Ted Ross <tross@redhat.com>
Committed: Tue Sep 8 14:53:28 2015 -0400

----------------------------------------------------------------------
 src/router_node.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/0ed628f2/src/router_node.c
----------------------------------------------------------------------
diff --git a/src/router_node.c b/src/router_node.c
index 652df85..fda1c97 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -355,15 +355,28 @@ static int qd_router_find_mask_bit_LH(qd_router_t *router, qd_link_t
*link)
  */
 static qd_address_t *router_lookup_terminus_LH(qd_router_t *router, const char *taddr, qd_direction_t
dir)
 {
-    char addr_prefix = (dir == QD_INCOMING) ? 'C' : 'D';
+    char                 addr_prefix = (dir == QD_INCOMING) ? 'C' : 'D';
+    qd_field_iterator_t *iter;
+    qd_address_t        *addr;
 
-    //
-    // For now: Find the first instance of a '.' in the address and search for the text
-    // up to and including this instance.
-    //
     if (taddr == 0 || *taddr == '\0')
         return 0;
 
+    //
+    // Start by searching for the entire address for a match
+    //
+    iter = qd_address_iterator_string(taddr, ITER_VIEW_ADDRESS_HASH);
+    qd_address_iterator_override_prefix(iter, addr_prefix);
+    qd_hash_retrieve(router->addr_hash, iter, (void*) &addr);
+    qd_field_iterator_free(iter);
+
+    if (addr)
+        return addr;
+
+    //
+    // If there was no match on the entire address, do a prefix search for the address up
to
+    // and including the first '.'
+    //
     const char *cursor = taddr;
     while (*cursor && *cursor != '.')
         cursor++;
@@ -371,10 +384,8 @@ static qd_address_t *router_lookup_terminus_LH(qd_router_t *router, const
char *
         cursor++;
     int len = (int) (cursor - taddr);
 
-    qd_field_iterator_t *iter = qd_address_iterator_binary(taddr, len, ITER_VIEW_ADDRESS_HASH);
+    iter = qd_address_iterator_binary(taddr, len, ITER_VIEW_ADDRESS_HASH);
     qd_address_iterator_override_prefix(iter, addr_prefix);
-
-    qd_address_t *addr;
     qd_hash_retrieve(router->addr_hash, iter, (void*) &addr);
     qd_field_iterator_free(iter);
 


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


Mime
View raw message