Skip to content

Commit

Permalink
fix: avoid send wrong hops with router-sync local services
Browse files Browse the repository at this point in the history
  • Loading branch information
giangndm committed Nov 29, 2024
1 parent 519182d commit 95126ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/core/router/src/core/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl Registry {
let mut res = vec![];
for i in 0..=255 {
if self.local_destinations[i as usize] {
res.push((i, Metric::new(0, vec![self.node_id], REGISTRY_LOCAL_BW)));
res.push((i, Metric::new(0, vec![], REGISTRY_LOCAL_BW)));
} else {
let dest: &RegistryDest = &self.remote_destinations[i as usize];
if !dest.is_empty() {
Expand Down Expand Up @@ -204,7 +204,7 @@ mod tests {
assert_eq!(registry.next(1, &[]), Some(ServiceDestination::Local));

let sync = registry.sync_for(node1);
assert_eq!(sync.0, vec![(1, Metric::new(0, vec![0], REGISTRY_LOCAL_BW))]);
assert_eq!(sync.0, vec![(1, Metric::new(0, vec![], REGISTRY_LOCAL_BW))]);
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion packages/core/router/src/core/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ mod tests {
let (node_e, conn_e, mut router_e) = create_router(0x05);
let (node_f, conn_f, mut router_f) = create_router(0x06);

let metric_registry_local = Metric::new(0, vec![node_a], REGISTRY_LOCAL_BW);
let metric_registry_local = Metric::new(0, vec![], REGISTRY_LOCAL_BW);

router_a.register_service(1);
router_a.set_direct(conn_d, Metric::new(1, vec![node_d], 1));
Expand Down

0 comments on commit 95126ec

Please sign in to comment.