Skip to content

Commit

Permalink
Fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
psiegl committed Nov 25, 2024
1 parent bd8b02f commit c16b12d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
4 changes: 2 additions & 2 deletions commons/zenoh-config/src/wrappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use std::str::FromStr;

use serde::{Deserialize, Serialize};
use zenoh_protocol::{
core::{key_expr::OwnedKeyExpr, EntityGlobalIdProto, EndPoint, WhatAmI, ZenohIdProto},
scouting::hello::HelloEndPoint
core::{key_expr::OwnedKeyExpr, EndPoint, EntityGlobalIdProto, WhatAmI, ZenohIdProto},
scouting::hello::HelloEndPoint,
};

/// The global unique id of a Zenoh session.
Expand Down
32 changes: 22 additions & 10 deletions zenoh/src/net/runtime/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use zenoh_config::{
use zenoh_link::{Locator, LocatorInspector};
use zenoh_protocol::{
core::{whatami::WhatAmIMatcher, EndPoint, Metadata, PriorityRange, WhatAmI, ZenohIdProto},
scouting::{HelloProto, Scout, ScoutingBody, ScoutingMessage, hello::HelloEndPoint},
scouting::{hello::HelloEndPoint, HelloProto, Scout, ScoutingBody, ScoutingMessage},
};
use zenoh_result::{bail, zerror, ZResult};

Expand Down Expand Up @@ -899,17 +899,27 @@ impl Runtime {
if let ScoutingBody::Hello(hello) = &msg.body {
if matcher.matches(hello.whatami) {
if let Ok(local_addr) = socket.local_addr() {
if let Ok(iface) = zenoh_util::net::get_interface_names_by_addr(local_addr.ip()) {
if let Ok(iface) =
zenoh_util::net::get_interface_names_by_addr(
local_addr.ip()
)
{
let endpoint = HelloEndPoint {
version: hello.version,
whatami: hello.whatami,
zid: hello.zid,
endpoints: hello.locators
endpoints: hello
.locators
.iter()
.map(|locator| EndPoint::new(locator.protocol(),
locator.address(),
locator.metadata(),
"iface=".to_string() + &iface[0]).unwrap())
.map(|locator|
EndPoint::new(
locator.protocol(),
locator.address(),
locator.metadata(),
"iface=".to_string() + &iface[0],
)
.unwrap()
)
.collect()
};
if let Loop::Break = f(endpoint.clone()).await {
Expand All @@ -921,10 +931,11 @@ impl Runtime {
version: hello.version,
whatami: hello.whatami,
zid: hello.zid,
endpoints: hello.locators
endpoints: hello
.locators
.iter()
.map(|locator| locator.to_endpoint())
.collect()
.collect(),
};
if let Loop::Break = f(endpoint.clone()).await {
break;
Expand Down Expand Up @@ -1105,7 +1116,8 @@ impl Runtime {
}

pub async fn connect_peer(&self, zid: &ZenohIdProto, locators: &[Locator]) -> bool {
let endpoints: Vec<EndPoint> = locators.iter()
let endpoints: Vec<EndPoint> = locators
.iter()
.map(|locator| locator.to_endpoint().clone())
.collect();
self.connect_endpoints(zid, &endpoints).await
Expand Down

0 comments on commit c16b12d

Please sign in to comment.