From 1c423a683dcb8826235decf8c0c0cefaa063d0e6 Mon Sep 17 00:00:00 2001 From: Lionel Henry Date: Wed, 28 Jun 2023 14:33:44 +0200 Subject: [PATCH] Make sure we don't infloop when no readable message is found --- crates/amalthea/src/kernel.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/amalthea/src/kernel.rs b/crates/amalthea/src/kernel.rs index 8e9e06e28..e9eb67fee 100644 --- a/crates/amalthea/src/kernel.rs +++ b/crates/amalthea/src/kernel.rs @@ -445,14 +445,12 @@ impl Kernel { } ); - while n > 0 { + for _ in 0..n { if let Some(index) = has_outbound() { unwrap!( forward_outbound(index), Err(err) => error!("While forwarding outbound message: {}", err) ); - - let _ = --n; continue; } @@ -461,10 +459,10 @@ impl Kernel { forward_inbound(), Err(err) => error!("While forwarding inbound message: {}", err) ); - - let _ = --n; continue; } + + log::warn!("Could not find readable message"); } } }