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:
+10
-2
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user