Skip to content

Commit

Permalink
Merge branch 'master' into simplified_load_plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Oct 30, 2023
2 parents f080df6 + b3ba1c4 commit 7a2ddb1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Note that the REST plugin is added to the configuration by the default value of
**[REST plugin](https://zenoh.io/docs/manual/plugin-http/)** (exposing a REST API):
This plugin converts GET and PUT REST requests into Zenoh gets and puts respectively.

**[Storages plugin](https://zenoh.io/docs/manual/plugin-storages/)** (managing [backends and storages](https://zenoh.io/docs/manual/backends/))
**[Storages plugin](https://zenoh.io/docs/manual/plugin-storage-manager/)** (managing [backends and storages](https://zenoh.io/docs/manual/plugin-storage-manager/#backends-and-volumes))
This plugin allows you to easily define storages. These will store key-value pairs they subscribed to, and send the most recent ones when queried. Check out [DEFAULT_CONFIG.json5](DEFAULT_CONFIG.json5) for info on how to configure them.

-------------------------------
Expand Down
7 changes: 5 additions & 2 deletions commons/zenoh-util/src/std_only/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ pub fn get_multicast_interfaces() -> Vec<IpAddr> {
pnet_datalink::interfaces()
.iter()
.filter_map(|iface| {
if iface.is_up() && iface.is_multicast() {
if iface.is_up() && iface.is_running() && iface.is_multicast() {
for ipaddr in &iface.ips {
if ipaddr.is_ipv4() {
return Some(ipaddr.ip());
Expand Down Expand Up @@ -266,7 +266,7 @@ pub fn get_unicast_addresses_of_multicast_interfaces() -> Vec<IpAddr> {
{
pnet_datalink::interfaces()
.iter()
.filter(|iface| iface.is_up() && iface.is_multicast())
.filter(|iface| iface.is_up() && iface.is_running() && iface.is_multicast())
.flat_map(|iface| {
iface
.ips
Expand Down Expand Up @@ -295,6 +295,9 @@ pub fn get_unicast_addresses_of_interface(name: &str) -> ZResult<Vec<IpAddr>> {
if !iface.is_up() {
bail!("Interface {name} is not up");
}
if !iface.is_running() {
bail!("Interface {name} is not running");
}
let addrs = iface
.ips
.iter()
Expand Down
5 changes: 3 additions & 2 deletions io/zenoh-transport/src/unicast/establishment/accept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,10 +658,11 @@ pub(crate) async fn accept_link(link: &LinkUnicast, manager: &TransportManager)
.map_err(|e| (e, Some(close::reason::INVALID))));

log::debug!(
"New transport link accepted from {} to {}: {}",
"New transport link accepted from {} to {}: {}. Batch size: {}.",
osyn_out.other_zid,
manager.config.zid,
link
link,
state.zenoh.batch_size,
);

Ok(())
Expand Down
5 changes: 3 additions & 2 deletions io/zenoh-transport/src/unicast/establishment/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,10 +573,11 @@ pub(crate) async fn open_link(
}

log::debug!(
"New transport link opened from {} to {}: {}",
"New transport link opened from {} to {}: {}. Batch size: {}.",
manager.config.zid,
iack_out.other_zid,
link
link,
state.zenoh.batch_size,
);

Ok(transport)
Expand Down
7 changes: 5 additions & 2 deletions io/zenoh-transport/src/unicast/lowlatency/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,11 @@ async fn rx_task_stream(
let mut length = [0_u8, 0_u8, 0_u8, 0_u8];
link.read_exact(&mut length).await?;
let n = u32::from_le_bytes(length) as usize;

link.read_exact(&mut buffer[0..n]).await?;
let len = buffer.len();
let b = buffer.get_mut(0..n).ok_or_else(|| {
zerror!("Batch len is invalid. Received {n} but negotiated max len is {len}.")
})?;
link.read_exact(b).await?;
Ok(n)
}

Expand Down
6 changes: 5 additions & 1 deletion io/zenoh-transport/src/unicast/universal/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,11 @@ async fn rx_task_stream(
let mut length = [0_u8, 0_u8];
link.read_exact(&mut length).await?;
let n = BatchSize::from_le_bytes(length) as usize;
link.read_exact(&mut buffer[0..n]).await?;
let len = buffer.len();
let b = buffer.get_mut(0..n).ok_or_else(|| {
zerror!("Batch len is invalid. Received {n} but negotiated max len is {len}.")
})?;
link.read_exact(b).await?;
Ok(Action::Read(n))
}

Expand Down

0 comments on commit 7a2ddb1

Please sign in to comment.