From 9a3ce91ef54210d418318696dccdf0d14fe2b5fd Mon Sep 17 00:00:00 2001 From: b-naber Date: Mon, 14 Feb 2022 22:18:10 +0100 Subject: [PATCH] util: fix waker update condition in `CancellationToken` (#4497) There was a missing exclamation mark in the condition we used to test whether we need a waker update in `check_for_cancellation`. --- tokio-util/src/sync/cancellation_token.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio-util/src/sync/cancellation_token.rs b/tokio-util/src/sync/cancellation_token.rs index f193f6bc3..8a89698c4 100644 --- a/tokio-util/src/sync/cancellation_token.rs +++ b/tokio-util/src/sync/cancellation_token.rs @@ -824,7 +824,7 @@ impl CancellationTokenState { let need_waker_update = wait_node .task .as_ref() - .map(|waker| waker.will_wake(cx.waker())) + .map(|waker| !waker.will_wake(cx.waker())) .unwrap_or(true); if need_waker_update {