-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't auto-connect to configured connect endpoints
- Loading branch information
1 parent
36b97aa
commit ecc05da
Showing
1 changed file
with
19 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
// ZettaScale Zenoh Team, <[email protected]> | ||
// | ||
use std::{ | ||
collections::HashSet, | ||
net::{IpAddr, Ipv6Addr, SocketAddr}, | ||
time::Duration, | ||
}; | ||
|
@@ -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 { | ||
|
@@ -968,7 +984,7 @@ impl Runtime { | |
tracing::warn!( | ||
"Unable to connect to any locator of scouted peer {}: {:?}", | ||
zid, | ||
locators | ||
scouted_locators | ||
); | ||
} else { | ||
tracing::trace!( | ||
|