Skip to content

Commit

Permalink
minor style change
Browse files Browse the repository at this point in the history
  • Loading branch information
carllerche committed Mar 1, 2024
1 parent d7dbbba commit 491593a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/sys/windows/named_pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,16 +942,18 @@ fn event_done(status: &OVERLAPPED_ENTRY, events: Option<&mut Vec<Event>>) {
let io = me.io.lock().unwrap();

// Make sure the I/O handle is still registered with the selector
//
// This method is also called during `Selector::drop` to perform cleanup. In
// this case, `events` is `None` and we don't need to track the event.
if io.token.is_some() && events.is_some() {
let mut ev = Event::from_completion_status(&status);
// Reverse the `.data` alteration done in `schedule_event`. This
// alteration was done so the selector recognized the event as one from
// a named pipe.
ev.data >>= 1;
events.expect("events must be some").push(ev);
if io.token.is_some() {
// This method is also called during `Selector::drop` to perform
// cleanup. In this case, `events` is `None` and we don't need to track
// the event.
if let Some(events) = events {
let mut ev = Event::from_completion_status(&status);
// Reverse the `.data` alteration done in `schedule_event`. This
// alteration was done so the selector recognized the event as one from
// a named pipe.
ev.data >>= 1;
events.push(ev);
}
}
}

Expand Down

0 comments on commit 491593a

Please sign in to comment.