qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject svn commit: r1541730 - in /qpid/dispatch/trunk/python/qpiddx/dispatch/router: node.py routing.py
Date Wed, 13 Nov 2013 21:26:01 GMT
Author: tross
Date: Wed Nov 13 21:26:01 2013
New Revision: 1541730

URL: http://svn.apache.org/r1541730
Log:
NO-JIRA - Increased the defensiveness of the code in several places.

Modified:
    qpid/dispatch/trunk/python/qpiddx/dispatch/router/node.py
    qpid/dispatch/trunk/python/qpiddx/dispatch/router/routing.py

Modified: qpid/dispatch/trunk/python/qpiddx/dispatch/router/node.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpiddx/dispatch/router/node.py?rev=1541730&r1=1541729&r2=1541730&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpiddx/dispatch/router/node.py (original)
+++ qpid/dispatch/trunk/python/qpiddx/dispatch/router/node.py Wed Nov 13 21:26:01 2013
@@ -107,8 +107,8 @@ class NodeTracker(object):
     def maskbit_for_node(self, node_id):
         """
         """
-        node = self.nodes[node_id]
-        if node:
+        if node_id in self.nodes:
+            node = self.nodes[node_id]
             return node.maskbit
         return None
 

Modified: qpid/dispatch/trunk/python/qpiddx/dispatch/router/routing.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/python/qpiddx/dispatch/router/routing.py?rev=1541730&r1=1541729&r2=1541730&view=diff
==============================================================================
--- qpid/dispatch/trunk/python/qpiddx/dispatch/router/routing.py (original)
+++ qpid/dispatch/trunk/python/qpiddx/dispatch/router/routing.py Wed Nov 13 21:26:01 2013
@@ -45,7 +45,8 @@ class RoutingTableEngine(object):
         for _id, next_hop in next_hops.items():
             mb_id = self.node_tracker.maskbit_for_node(_id)
             mb_nh = self.node_tracker.maskbit_for_node(next_hop)
-            self.container.router_adapter.set_next_hop(mb_id, mb_nh)
+            if mb_id and mb_nh:
+                self.container.router_adapter.set_next_hop(mb_id, mb_nh)
 
 
     def valid_origins_changed(self, valid_origins):
@@ -53,7 +54,9 @@ class RoutingTableEngine(object):
             mb_id = self.node_tracker.maskbit_for_node(_id)
             mb_vo = []
             for o in vo:
-                mb_vo.append(self.node_tracker.maskbit_for_node(o))
+                mb = self.node_tracker.maskbit_for_node(o)
+                if mb != None:
+                    mb_vo.append(mb)
             self.container.router_adapter.set_valid_origins(mb_id, mb_vo)
 
 



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


Mime
View raw message