qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject qpid-dispatch git commit: DISPATCH-928: check for null return from qdr_address_CT
Date Fri, 23 Feb 2018 14:06:10 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/master db5af96ca -> 00a0233c3


DISPATCH-928: check for null return from qdr_address_CT


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

Branch: refs/heads/master
Commit: 00a0233c337c8db24006acab7eece8970e5fe616
Parents: db5af96
Author: Gordon Sim <gsim@redhat.com>
Authored: Fri Feb 23 14:05:17 2018 +0000
Committer: Gordon Sim <gsim@redhat.com>
Committed: Fri Feb 23 14:05:17 2018 +0000

----------------------------------------------------------------------
 src/router_core/route_control.c |  8 +++++++-
 src/router_core/route_tables.c  | 21 ++++++++++++---------
 2 files changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/00a0233c/src/router_core/route_control.c
----------------------------------------------------------------------
diff --git a/src/router_core/route_control.c b/src/router_core/route_control.c
index 690b151..c7e043e 100644
--- a/src/router_core/route_control.c
+++ b/src/router_core/route_control.c
@@ -318,6 +318,7 @@ qdr_link_route_t *qdr_route_add_link_route_CT(qdr_core_t             *core,
         qd_hash_retrieve(core->addr_hash, a_iter, (void*) &lr->addr);
         if (!lr->addr) {
             lr->addr = qdr_address_CT(core, treatment);
+            //treatment will not be undefined for link route so above will not return null
             DEQ_INSERT_TAIL(core->addrs, lr->addr);
             qd_hash_insert(core->addr_hash, a_iter, lr->addr, &lr->addr->hash_handle);
             qdr_link_route_map_pattern_CT(core, a_iter, lr->addr);
@@ -417,7 +418,12 @@ qdr_auto_link_t *qdr_route_add_auto_link_CT(qdr_core_t          *core,
 
     qd_hash_retrieve(core->addr_hash, iter, (void*) &al->addr);
     if (!al->addr) {
-        al->addr = qdr_address_CT(core, qdr_treatment_for_address_CT(core, 0, iter, 0,
0));
+        qd_address_treatment_t treatment = qdr_treatment_for_address_CT(core, 0, iter, 0,
0);
+        if (treatment == QD_TREATMENT_UNAVAILABLE) {
+            //if associated address is not defined, assume balanced
+            treatment = QD_TREATMENT_ANYCAST_BALANCED;
+        }
+        al->addr = qdr_address_CT(core, treatment);
         DEQ_INSERT_TAIL(core->addrs, al->addr);
         qd_hash_insert(core->addr_hash, iter, al->addr, &al->addr->hash_handle);
     }

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/00a0233c/src/router_core/route_tables.c
----------------------------------------------------------------------
diff --git a/src/router_core/route_tables.c b/src/router_core/route_tables.c
index 86a7aa4..6a1ae57 100644
--- a/src/router_core/route_tables.c
+++ b/src/router_core/route_tables.c
@@ -576,6 +576,7 @@ static void qdr_map_destination_CT(qdr_core_t *core, qdr_action_t *action,
bool
         qd_hash_retrieve(core->addr_hash, iter, (void**) &addr);
         if (!addr) {
             addr = qdr_address_CT(core, qdr_treatment_for_address_hash_CT(core, iter));
+            if (!addr) break;
             qd_hash_insert(core->addr_hash, iter, addr, &addr->hash_handle);
             DEQ_ITEM_INIT(addr);
             DEQ_INSERT_TAIL(core->addrs, addr);
@@ -668,16 +669,18 @@ static void qdr_subscribe_CT(qdr_core_t *core, qdr_action_t *action,
bool discar
         qd_hash_retrieve(core->addr_hash, address->iterator, (void**) &addr);
         if (!addr) {
             addr = qdr_address_CT(core, action->args.io.treatment);
-            qd_hash_insert(core->addr_hash, address->iterator, addr, &addr->hash_handle);
-            DEQ_ITEM_INIT(addr);
-            DEQ_INSERT_TAIL(core->addrs, addr);
+            if (addr) {
+                qd_hash_insert(core->addr_hash, address->iterator, addr, &addr->hash_handle);
+                DEQ_ITEM_INIT(addr);
+                DEQ_INSERT_TAIL(core->addrs, addr);
+            }
+        }
+        if (addr) {
+            sub->addr = addr;
+            DEQ_ITEM_INIT(sub);
+            DEQ_INSERT_TAIL(addr->subscriptions, sub);
+            qdr_addr_start_inlinks_CT(core, addr);
         }
-
-        sub->addr = addr;
-        DEQ_ITEM_INIT(sub);
-        DEQ_INSERT_TAIL(addr->subscriptions, sub);
-        qdr_addr_start_inlinks_CT(core, addr);
-
     } else
         free(sub);
 


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


Mime
View raw message