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:
Generated
+3
-3
@@ -52,13 +52,13 @@
|
|||||||
"freebsd-libs-packed": {
|
"freebsd-libs-packed": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"narHash": "sha256-l9YQPyra0F4guqiI4rW5XsZxGP1Usy//nglUVFlqY1c=",
|
"narHash": "sha256-2CAlSeK9dsP6RG9UDZJo2gaxRUdJw/DDTSyJibU2N5c=",
|
||||||
"type": "file",
|
"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": {
|
"original": {
|
||||||
"type": "file",
|
"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": {
|
"libcap-src": {
|
||||||
|
|||||||
+10
-2
@@ -438,9 +438,17 @@ impl WaitHandle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[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 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();
|
guard.clear_ready();
|
||||||
drop(guard);
|
drop(guard);
|
||||||
async_fd.into_inner();
|
async_fd.into_inner();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ impl RawSocket {
|
|||||||
let name = std::str::from_utf8(&name_raw)?;
|
let name = std::str::from_utf8(&name_raw)?;
|
||||||
let mut lower = Interface::new(name)?;
|
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_promisc(promisc)?;
|
||||||
lower.set_buffer_size(mtu as i32)?;
|
lower.set_buffer_size(mtu as i32)?;
|
||||||
|
|||||||
Reference in New Issue
Block a user