Skip to content

Commit

Permalink
Don't auto-connect to configured connect endpoints (#1396)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz committed Sep 23, 2024
1 parent 2b2c3d6 commit 77e040b
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions zenoh/src/net/runtime/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use std::{
collections::HashSet,
net::{IpAddr, Ipv6Addr, SocketAddr},
time::Duration,
};
Expand Down Expand Up @@ -911,8 +912,23 @@ impl Runtime {
}

#[must_use]
async fn connect(&self, zid: &ZenohIdProto, locators: &[Locator]) -> bool {
const ERR: &str = "Unable to connect to newly scouted peer ";
async fn connect(&self, zid: &ZenohIdProto, scouted_locators: &[Locator]) -> bool {
const ERR: &str = "Unable to connect to newly scouted peer";

let configured_locators = self
.state
.config
.lock()
.connect()
.endpoints()
.get(self.whatami())
.iter()
.flat_map(|e| e.iter().map(EndPoint::to_locator))
.collect::<HashSet<_>>();

let locators = scouted_locators
.iter()
.filter(|l| !configured_locators.contains(l));

let inspector = LocatorInspector::default();
for locator in locators {
Expand Down Expand Up @@ -968,7 +984,7 @@ impl Runtime {
tracing::warn!(
"Unable to connect to any locator of scouted peer {}: {:?}",
zid,
locators
scouted_locators
);
} else {
tracing::trace!(
Expand Down

0 comments on commit 77e040b

Please sign in to comment.