Values, Cleaning, Docs, Tests, Example (Current Example is Wrong)

This commit is contained in:
Alex Emmet 2026-06-22 23:29:18 +02:00
commit c2a7afe6c1
37 changed files with 1693 additions and 520 deletions

View file

@ -11,14 +11,15 @@ wtransport = { version = "0.7.1", default-features = false, features = [
"quinn",
"self-signed",
] }
rustls = { version = "0.23.40" }
quinn = { version = "0.11.9", default-features = false, features = [
rustls = { version = "0.23.41" }
quinn = { version = "0.11.11", default-features = false, features = [
"rustls-aws-lc-rs",
"rustls",
] }
tokio = { version = "1", features = ["full"] }
thiserror = "2.0.18"
rustls-native-certs = "0.8.4"
log = "0.4"
[features]
default = []

View file

@ -53,10 +53,10 @@ impl Default for Policy {
}
}
#[allow(unused)]
enum ReceivedFrame {
Message(CommunicationValue),
ClosedByPeer,
#[allow(dead_code)]
Idle,
}
@ -215,7 +215,7 @@ impl Sender {
.await
.map_err(|_| CommunicationError::StreamError)?
{
println!("[Sender] close frame finish failed: {e}");
log::warn!("[Sender] close frame finish failed: {e}");
}
Ok(())
@ -445,7 +445,7 @@ impl Receiver {
if e.kind() == ErrorKind::UnexpectedEof {
return Ok(ReceivedFrame::Idle);
}
println!("[Receiver] read_u32 failed: {e}");
log::warn!("[Receiver] read_u32 failed: {e}");
return Err(CommunicationError::StreamError);
}
}
@ -468,13 +468,13 @@ impl Receiver {
_ => return Err(e.into()),
},
Err(_) => {
println!("[Receiver] read_exact timed out (len={})", len);
log::warn!("[Receiver] read_exact timed out (len={})", len);
return Err(CommunicationError::StreamError);
}
}
let message = CommunicationValue::from_bytes(&buf)
.ok_or(CommunicationError::ParseCommunicationValue)?;
.map_err(|_| CommunicationError::ParseCommunicationValue)?;
Ok(ReceivedFrame::Message(message))
}

View file

@ -108,7 +108,8 @@ async fn configure_server(
.ok()
.and_then(|s| if s.is_empty() { None } else { Some(s) })
.unwrap_or_else(|| "::".to_string())
.parse::<IpAddr>()?;
.parse::<IpAddr>()
.map_err(|e| CommunicationError::ParseError(e.to_string()))?;
let bind_addr = SocketAddr::new(bind_ip, port);
let server_config = ServerConfig::builder()