Merge pull request 'Update Rust crate if-addrs to 0.10.2' (#2) from renovate/if-addrs-0.x into master

Reviewed-on: #2
This commit is contained in:
hodasemi 2023-10-07 07:06:25 +02:00
commit e614c2a753
4 changed files with 21 additions and 14 deletions

View file

@ -7,7 +7,7 @@ edition = "2021"
[dependencies]
anyhow = { version = "1.0.75", features = ["backtrace"] }
if-addrs = "0.10.1"
if-addrs = "0.10.2"
rand = "0.8.5"
chrono = "0.4.31"
serde = { version = "1.0", features = ["derive"] }

View file

@ -474,6 +474,7 @@ mod test {
use super::Cloud;
#[tokio::test]
#[serial]
async fn reroute() -> Result<()> {
let mut cloud = Cloud::new("michaelh.95@t-online.de", "Hoda.semi1")?;
@ -483,6 +484,7 @@ mod test {
}
#[tokio::test]
#[serial]
async fn login_id() -> Result<()> {
let mut cloud = Cloud::new("michaelh.95@t-online.de", "Hoda.semi1")?;

View file

@ -5,6 +5,7 @@ pub trait RequestSerializer {
fn serialize(&self) -> Vec<u8>;
}
#[derive(Clone)]
pub struct CommandRequest {
#[cfg(debug_assertions)]
pub name: &'static str,

View file

@ -124,22 +124,24 @@ impl Device {
}
for cmd in cmds {
self.build_send(cmd)?;
'sending: loop {
self.build_send(cmd.clone())?;
loop {
let mut buf = [0; 512];
let bytes_read = match self.socket.lock().unwrap().read(&mut buf) {
Ok(b) => b,
Err(_) => continue,
};
loop {
let mut buf = [0; 512];
let bytes_read = match self.socket.lock().unwrap().read(&mut buf) {
Ok(b) => b,
Err(_) => continue,
};
if bytes_read == 0 {
bail!("socket error");
}
if bytes_read == 0 {
break;
}
match self.parse_message(&buf[..bytes_read])? {
ParseMessage::Success => break,
ParseMessage::Padding => continue,
match self.parse_message(&buf[..bytes_read])? {
ParseMessage::Success => break 'sending,
ParseMessage::Padding => continue,
}
}
}
}
@ -252,6 +254,7 @@ mod test {
use crate::{device::Device, devices::AttributeValue, Cloud, Startup};
#[tokio::test]
#[serial]
async fn verify_hex() -> Result<()> {
let devices = Startup::discover().await?;
@ -272,6 +275,7 @@ mod test {
}
#[tokio::test]
#[serial]
async fn connect_py_token() -> Result<()> {
let devices = Startup::discover().await?;