Use the try-iter method from concurrent-queue (#105)

This commit is contained in:
John Nunley 2023-04-08 22:05:37 -07:00 committed by GitHub
parent 8f6d039b26
commit 6857a165aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -33,7 +33,7 @@ libc = "0.2.77"
[target.'cfg(windows)'.dependencies]
bitflags = "1.3.2"
concurrent-queue = "2.1.0"
concurrent-queue = "2.2.0"
pin-project-lite = "0.2.9"
[target.'cfg(windows)'.dependencies.windows-sys]

View File

@ -352,7 +352,8 @@ impl Poller {
};
// Only drain the queue's capacity, since this could in theory run forever.
core::iter::from_fn(|| self.pending_updates.pop().ok())
self.pending_updates
.try_iter()
.take(max)
.try_for_each(|packet| packet.update())
}