Skip to content

Commit 7a75570

Browse files
author
Hugo Laloge
committed
Don't assume TransportManager::get_locators will always yield the locators in the same order
1 parent 83f3393 commit 7a75570

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

zenoh/src/net/runtime/orchestrator.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -547,14 +547,9 @@ impl Runtime {
547547
pub fn update_locators(&self) -> bool {
548548
let mut locators = self.state.locators.write().unwrap();
549549
let new_locators = self.manager().get_locators();
550-
if new_locators == *locators {
550+
if are_locators_equal(&locators, &new_locators) {
551551
return false;
552552
}
553-
554-
tracing::info!(
555-
"New locators: {new_locators:?}, previously: {:?}",
556-
*locators
557-
);
558553
if tracing::enabled!(tracing::Level::INFO) {
559554
for locator in &new_locators {
560555
if !locators.contains(locator) {
@@ -1040,3 +1035,9 @@ impl Runtime {
10401035
router.tables.hat_code.links_info(&tables)
10411036
}
10421037
}
1038+
1039+
fn are_locators_equal(a: &[Locator], b: &[Locator]) -> bool {
1040+
a.len() == b.len()
1041+
&& HashSet::<&Locator, std::hash::RandomState>::from_iter(a.iter())
1042+
== HashSet::from_iter(b.iter())
1043+
}

0 commit comments

Comments
 (0)