diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ac05e7..24a8be0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ Unreleased ---------- +- Fixed ping sending after change in `tokio` `Interval` API with version + `1.27.0` - Switched to using Rust 2021 Edition diff --git a/Cargo.toml b/Cargo.toml index 06c74a1..a0df251 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ tokio-tungstenite = {version = "0.18", default-features = false, features = ["co rand = {version = "0.8", default-features = false, features = ["std", "std_rng"]} serde = {version = "1.0", features = ["derive"]} test-log = {version = "0.2.8", default-features = false, features = ["trace"]} -tokio = {version = "1.0", default-features = false, features = ["rt", "macros", "net"]} +tokio = {version = "1.27", default-features = false, features = ["rt", "macros", "net"]} tracing-subscriber = {version = "0.3", default-features = false, features = ["ansi", "env-filter", "fmt", "local-time"]} url = "2.0" diff --git a/src/wrap.rs b/src/wrap.rs index 4006a4d..03d1d00 100644 --- a/src/wrap.rs +++ b/src/wrap.rs @@ -225,6 +225,10 @@ impl Pinger { match self.next_ping.poll_tick(ctx) { StdPoll::Ready(_) => { + // When using the `poll_tick` API, we are on the hook for + // resetting the interval to be woken up again when it passed. + let () = self.next_ping.reset(); + // We are due sending a ping according to the user's specified // ping interval. Check the existing ping state to decide what // to actually do. We may not need to send a ping if we can