summaryrefslogtreecommitdiffstats
path: root/crates/driver/src/driver.rs
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2023-09-30 20:21:09 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2023-09-30 20:21:09 +0200
commite77305d3dc7e89474b14f86b180fc0ac51db3678 (patch)
tree81a25f3ea92fd7b3098f035d6475e5e533094b5c /crates/driver/src/driver.rs
parentfbaa41611d2aa30815a3d9d3c214698825bc6896 (diff)
downloadrebel-e77305d3dc7e89474b14f86b180fc0ac51db3678.tar
rebel-e77305d3dc7e89474b14f86b180fc0ac51db3678.zip
Update dependencies
Diffstat (limited to 'crates/driver/src/driver.rs')
-rw-r--r--crates/driver/src/driver.rs21
1 files changed, 14 insertions, 7 deletions
diff --git a/crates/driver/src/driver.rs b/crates/driver/src/driver.rs
index dfdd6e9..d0abbcb 100644
--- a/crates/driver/src/driver.rs
+++ b/crates/driver/src/driver.rs
@@ -349,17 +349,25 @@ impl<'ctx> Driver<'ctx> {
}
fn wait_for_task(&mut self) -> Result<()> {
- let mut pollfds: Box<[_]> = self
+ let mut pollfds: Vec<_> = self
.tasks_running
- .keys()
- .copied()
- .map(|fd| poll::PollFd::new(fd, poll::PollFlags::POLLIN))
+ .values()
+ .map(|(socket, _)| poll::PollFd::new(socket, poll::PollFlags::POLLIN))
.collect();
while poll::poll(&mut pollfds, -1).context("poll()")? == 0 {}
- for pollfd in &*pollfds {
- let events = pollfd.revents().expect("Unknown events in poll() return");
+ let pollevents: Vec<_> = pollfds
+ .into_iter()
+ .map(|pollfd| {
+ (
+ pollfd.as_fd().as_raw_fd(),
+ pollfd.revents().expect("Unknown events in poll() return"),
+ )
+ })
+ .collect();
+
+ for (fd, events) in pollevents {
if !events.contains(poll::PollFlags::POLLIN) {
if events.intersects(!poll::PollFlags::POLLIN) {
return Err(Error::new(
@@ -369,7 +377,6 @@ impl<'ctx> Driver<'ctx> {
continue;
}
- let fd = pollfd.as_raw_fd();
let (socket, task_ref) = self.tasks_running.remove(&fd).unwrap();
let task_output = Runner::result(&socket)?;