cros_async: Don't wake wakers on removal

There is no need to repoll the waker after it is canceled. This was a
copy paste error that was harmless until tested with futures-rs
combinators that re-use wakers aggressively.

Change-Id: Ie84778b96ff6aa2b58bfe61cd96a78786797ad78
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2173971
Tested-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
This commit is contained in:
Dylan Reid 2020-04-29 22:28:23 +00:00 committed by Commit Bot
parent aee62a8add
commit f60fb14a72

View file

@ -186,9 +186,8 @@ impl FdWakerState {
// Remove the waker for the given token if it hasn't fired yet.
fn cancel_waker(&mut self, token: WakerToken) -> Result<()> {
if let Some((fd, waker)) = self.token_map.remove(&token.0) {
if let Some((fd, _waker)) = self.token_map.remove(&token.0) {
self.poll_ctx.delete(&fd).map_err(Error::PollContextError)?;
waker.wake_by_ref();
}
Ok(())
}