Clippy
This commit is contained in:
parent
357eb73c6f
commit
931e30601e
2 changed files with 19 additions and 16 deletions
|
@ -244,6 +244,7 @@ pub mod builtin {
|
||||||
|
|
||||||
const IP_BIND_ADDR: (IpAddr, u16) = (IpAddr::V6(Ipv6Addr::UNSPECIFIED), 5353);
|
const IP_BIND_ADDR: (IpAddr, u16) = (IpAddr::V6(Ipv6Addr::UNSPECIFIED), 5353);
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn create_record(
|
pub fn create_record(
|
||||||
id: u16,
|
id: u16,
|
||||||
hostname: &str,
|
hostname: &str,
|
||||||
|
@ -552,6 +553,7 @@ pub mod builtin {
|
||||||
select(&mut broadcast, &mut respond).await.unwrap()
|
select(&mut broadcast, &mut respond).await.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::await_holding_refcell_ref)]
|
||||||
async fn broadcast(&self) -> Result<(), Error> {
|
async fn broadcast(&self) -> Result<(), Error> {
|
||||||
loop {
|
loop {
|
||||||
select(
|
select(
|
||||||
|
@ -562,29 +564,30 @@ pub mod builtin {
|
||||||
|
|
||||||
let mut index = 0;
|
let mut index = 0;
|
||||||
|
|
||||||
while let Some(entry) = self
|
loop {
|
||||||
.0
|
let entry = self.0.entries.borrow().get(index).cloned();
|
||||||
.entries
|
|
||||||
.borrow()
|
|
||||||
.get(index)
|
|
||||||
.map(|entry| entry.clone())
|
|
||||||
{
|
|
||||||
info!("Broadasting mDNS entry {}", &entry.key);
|
|
||||||
|
|
||||||
self.0.bind().await?;
|
if let Some(entry) = entry {
|
||||||
|
info!("Broadasting mDNS entry {}", &entry.key);
|
||||||
|
|
||||||
let udp = self.0.udp.borrow();
|
self.0.bind().await?;
|
||||||
let udp = udp.as_ref().unwrap();
|
|
||||||
|
|
||||||
for (addr, port) in IP_BROADCAST_ADDRS {
|
let udp = self.0.udp.borrow();
|
||||||
udp.send(SocketAddr::new(addr, port), &entry.record).await?;
|
let udp = udp.as_ref().unwrap();
|
||||||
|
|
||||||
|
for (addr, port) in IP_BROADCAST_ADDRS {
|
||||||
|
udp.send(SocketAddr::new(addr, port), &entry.record).await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
index += 1;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
index += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::await_holding_refcell_ref)]
|
||||||
async fn respond(&self) -> Result<(), Error> {
|
async fn respond(&self) -> Result<(), Error> {
|
||||||
loop {
|
loop {
|
||||||
let mut buf = [0; 1580];
|
let mut buf = [0; 1580];
|
||||||
|
|
|
@ -68,7 +68,7 @@ impl DataHandler for DataModel {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
let cmd_path_ib = i.path;
|
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.endpoint = cmd_path_ib.path.endpoint.unwrap_or(1);
|
||||||
common_data.cluster = cmd_path_ib.path.cluster.unwrap_or(0);
|
common_data.cluster = cmd_path_ib.path.cluster.unwrap_or(0);
|
||||||
common_data.command = cmd_path_ib.path.leaf.unwrap_or(0) as u16;
|
common_data.command = cmd_path_ib.path.leaf.unwrap_or(0) as u16;
|
||||||
|
|
Loading…
Add table
Reference in a new issue