Skip to content

Commit a9b0797

Browse files
committed
fix(driver,iocp): ignore if repost
1 parent 894545a commit a9b0797

File tree

1 file changed

+4
-3
lines changed
  • compio-driver/src/iocp/cp

1 file changed

+4
-3
lines changed

compio-driver/src/iocp/cp/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ impl CompletionPort {
141141
timeout: Option<Duration>,
142142
current_driver: Option<RawFd>,
143143
) -> io::Result<impl Iterator<Item = Entry>> {
144-
Ok(self.poll_raw(timeout)?.map(move |entry| {
144+
Ok(self.poll_raw(timeout)?.filter_map(move |entry| {
145145
// Any thin pointer is OK because we don't use the type of opcode.
146146
let overlapped_ptr: *mut Overlapped<()> = entry.lpOverlapped.cast();
147147
let overlapped = unsafe { &*overlapped_ptr };
148148
if let Some(current_driver) = current_driver {
149149
if overlapped.driver != current_driver {
150-
// Repose the entry to correct port.
150+
// Repost the entry to correct port.
151151
if let Err(_e) = syscall!(
152152
BOOL,
153153
PostQueuedCompletionStatus(
@@ -166,6 +166,7 @@ impl CompletionPort {
166166
_e
167167
);
168168
}
169+
return None;
169170
}
170171
}
171172
let res = if matches!(
@@ -180,7 +181,7 @@ impl CompletionPort {
180181
_ => Err(io::Error::from_raw_os_error(error as _)),
181182
}
182183
};
183-
Entry::new(overlapped.user_data, res)
184+
Some(Entry::new(overlapped.user_data, res))
184185
}))
185186
}
186187
}

0 commit comments

Comments
 (0)