Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't auto-connect to configured connect endpoints #1396

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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