Skip to content

Commit

Permalink
fix(poll): flags of renew event
Browse files Browse the repository at this point in the history
  • Loading branch information
Berrysoft committed Nov 22, 2024
1 parent 2997c51 commit 3617877
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions compio-driver/src/poll/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl FdQueue {
}

pub fn event(&self) -> Event {
let mut event = Event::all(0);
let mut event = Event::none(0);
if let Some(&key) = self.read_queue.front() {
event.readable = true;
event.key = key;
Expand Down Expand Up @@ -337,14 +337,16 @@ impl Driver {
let user_data = event.key;
trace!("receive {} for {:?}", user_data, event);
let mut op = Key::<dyn crate::sys::OpCode>::new_unchecked(user_data);
let mut op = op.as_op_pin();
match op.as_mut().op_type() {
let op = op.as_op_pin();
match op.op_type() {
None => {
// On epoll, multiple event may be received even if it is registered as
// one-shot. It is safe to ignore it.
trace!("op {} is completed", user_data);
}
Some(OpType::Fd(fd)) => {
// If it's an FD op, the returned user_data is only for calling `op_type`. We
// need to pop the real user_data from the queue.
let queue = self
.registry
.get_mut(&fd)
Expand All @@ -353,6 +355,8 @@ impl Driver {
if self.cancelled.remove(&user_data) {
entry_cancelled(user_data).notify();
} else {
let mut op = Key::<dyn crate::sys::OpCode>::new_unchecked(user_data);
let op = op.as_op_pin();
let res = match op.operate() {
Poll::Pending => {
// The operation should go back to the front.
Expand Down

0 comments on commit 3617877

Please sign in to comment.