Unverified Commit 4080e822 authored by Lianmin Zheng's avatar Lianmin Zheng Committed by GitHub
Browse files

Fix the case where r.prefix_indices is None (#1031)

parent c245b789
...@@ -35,13 +35,12 @@ class PolicyScheduler: ...@@ -35,13 +35,12 @@ class PolicyScheduler:
self.tree_cache = tree_cache self.tree_cache = tree_cache
def calc_priority(self, waiting_queue: List[Req]): def calc_priority(self, waiting_queue: List[Req]):
if self.policy in ["lpm", "dfs-weight"]: # Compute matched prefix length
# Compute matched prefix length for r in waiting_queue:
for r in waiting_queue: # NOTE: the prefix_indices must always be aligned with last_node
# NOTE: the prefix_indices must always be aligned with last_node r.prefix_indices, r.last_node = self.tree_cache.match_prefix(
r.prefix_indices, r.last_node = self.tree_cache.match_prefix( rid=r.rid, key=r.adjust_max_prefix_ids()
rid=r.rid, key=r.adjust_max_prefix_ids() )
)
if self.policy == "lpm": if self.policy == "lpm":
# Longest Prefix Match # Longest Prefix Match
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment