fix: use better timings

Linux beacons weren't timing out and attempting to continue driving the
connection

Windows beacons still get stuck on their first connection, but that is
good enough for demonstration purposes
This commit is contained in:
Andrew Rioux
2026-08-04 23:20:06 -04:00
parent a56f6e6cb9
commit fcbf82c86e
3 changed files with 14 additions and 6 deletions
Generated
+3 -3
View File
@@ -52,13 +52,13 @@
"freebsd-libs-packed": {
"flake": false,
"locked": {
"narHash": "sha256-l9YQPyra0F4guqiI4rW5XsZxGP1Usy//nglUVFlqY1c=",
"narHash": "sha256-2CAlSeK9dsP6RG9UDZJo2gaxRUdJw/DDTSyJibU2N5c=",
"type": "file",
"url": "https://download.freebsd.org/releases/amd64/14.1-RELEASE/base.txz"
"url": "https://download.freebsd.org/releases/amd64/14.3-RELEASE/base.txz"
},
"original": {
"type": "file",
"url": "https://download.freebsd.org/releases/amd64/14.1-RELEASE/base.txz"
"url": "https://download.freebsd.org/releases/amd64/14.3-RELEASE/base.txz"
}
},
"libcap-src": {
+10 -2
View File
@@ -438,9 +438,17 @@ impl WaitHandle {
}
#[cfg(unix)]
pub async fn wait(&self, _timeout: Option<Duration>) -> error::Result<()> {
pub async fn wait(&self, timeout: Option<Duration>) -> error::Result<()> {
let async_fd = tokio::io::unix::AsyncFd::new(self.0)?;
let mut guard = async_fd.ready(tokio::io::Interest::READABLE).await?;
let mut guard = match tokio::time::timeout(
timeout.unwrap_or(std::time::Duration::from_millis(50)),
async_fd.ready(tokio::io::Interest::READABLE)
).await {
Ok(v) => v,
Err(_) => {
return Ok(())
}
}?;
guard.clear_ready();
drop(guard);
async_fd.into_inner();
+1 -1
View File
@@ -24,7 +24,7 @@ impl RawSocket {
let name = std::str::from_utf8(&name_raw)?;
let mut lower = Interface::new(name)?;
let mtu = a_interface.mtu as usize - if cfg!(unix) { 14 } else { 0 };
let mtu = a_interface.mtu as usize - if cfg!(unix) { 28 } else { 0 };
lower.set_promisc(promisc)?;
lower.set_buffer_size(mtu as i32)?;