Skip to content

Commit

Permalink
Set the listener slot to None after finishing
Browse files Browse the repository at this point in the history
Signed-off-by: John Nunley <dev@notgull.net>
  • Loading branch information
notgull committed Dec 21, 2023
1 parent 7929559 commit c13adc3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,11 @@ impl<'a, 'evl> Strategy<'evl> for NonBlocking<'a> {
event_listener: &mut Option<L>,
context: &mut Self::Context,
) -> Poll<T> {
Pin::new(event_listener.as_mut().expect("`event_listener` should never be `None`")).poll(context)
let poll = Pin::new(event_listener.as_mut().expect("`event_listener` should never be `None`")).poll(context);
if poll.is_ready() {
*event_listener = None;
}
poll
}
}

Expand Down

0 comments on commit c13adc3

Please sign in to comment.