From 979c0c8685a0b5a343b7a069a7aa86c85b9067da Mon Sep 17 00:00:00 2001 From: Lukasz Rzasik Date: Wed, 11 Dec 2024 20:41:46 +0100 Subject: [PATCH] Keep the task for view one less than the current. We might still be transmitting --- crates/task-impls/src/network.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/task-impls/src/network.rs b/crates/task-impls/src/network.rs index b885e2f7e5..1ca2dc2379 100644 --- a/crates/task-impls/src/network.rs +++ b/crates/task-impls/src/network.rs @@ -361,7 +361,11 @@ impl< /// Cancel all tasks for previous views pub fn cancel_tasks(&mut self, view: TYPES::View) { - let keep = self.transmit_tasks.split_off(&view); + if *view == 0 { + return; + } + let keep_view = view - 1; + let keep = self.transmit_tasks.split_off(&keep_view); while let Some((_, tasks)) = self.transmit_tasks.pop_first() { for task in tasks {