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

This commit is contained in:
Lianmin Zheng
2024-08-11 04:53:51 -07:00
committed by GitHub
parent c245b78973
commit 4080e82244

View File

@@ -35,13 +35,12 @@ class PolicyScheduler:
self.tree_cache = tree_cache
def calc_priority(self, waiting_queue: List[Req]):
if self.policy in ["lpm", "dfs-weight"]:
# Compute matched prefix length
for r in waiting_queue:
# NOTE: the prefix_indices must always be aligned with last_node
r.prefix_indices, r.last_node = self.tree_cache.match_prefix(
rid=r.rid, key=r.adjust_max_prefix_ids()
)
# Compute matched prefix length
for r in waiting_queue:
# NOTE: the prefix_indices must always be aligned with last_node
r.prefix_indices, r.last_node = self.tree_cache.match_prefix(
rid=r.rid, key=r.adjust_max_prefix_ids()
)
if self.policy == "lpm":
# Longest Prefix Match