This commit is contained in:
ivmarkov 2023-05-28 11:13:02 +00:00
parent 357eb73c6f
commit 931e30601e
2 changed files with 19 additions and 16 deletions

View file

@ -244,6 +244,7 @@ pub mod builtin {
const IP_BIND_ADDR: (IpAddr, u16) = (IpAddr::V6(Ipv6Addr::UNSPECIFIED), 5353);
#[allow(clippy::too_many_arguments)]
pub fn create_record(
id: u16,
hostname: &str,
@ -552,6 +553,7 @@ pub mod builtin {
select(&mut broadcast, &mut respond).await.unwrap()
}
#[allow(clippy::await_holding_refcell_ref)]
async fn broadcast(&self) -> Result<(), Error> {
loop {
select(
@ -562,13 +564,10 @@ pub mod builtin {
let mut index = 0;
while let Some(entry) = self
.0
.entries
.borrow()
.get(index)
.map(|entry| entry.clone())
{
loop {
let entry = self.0.entries.borrow().get(index).cloned();
if let Some(entry) = entry {
info!("Broadasting mDNS entry {}", &entry.key);
self.0.bind().await?;
@ -581,10 +580,14 @@ pub mod builtin {
}
index += 1;
} else {
break;
}
}
}
}
#[allow(clippy::await_holding_refcell_ref)]
async fn respond(&self) -> Result<(), Error> {
loop {
let mut buf = [0; 1580];

View file

@ -68,7 +68,7 @@ impl DataHandler for DataModel {
continue;
};
let cmd_path_ib = i.path;
let mut common_data = &mut self.node;
let common_data = &mut self.node;
common_data.endpoint = cmd_path_ib.path.endpoint.unwrap_or(1);
common_data.cluster = cmd_path_ib.path.cluster.unwrap_or(0);
common_data.command = cmd_path_ib.path.leaf.unwrap_or(0) as u16;