From 1b75b8936b157f15632307c315d5fd1b585e1d21 Mon Sep 17 00:00:00 2001 From: Himbeer Date: Mon, 24 Mar 2025 13:47:15 +0100 Subject: Fix infinite loop on failed connectivity check --- src/main.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8475693..1a0a443 100644 --- a/src/main.rs +++ b/src/main.rs @@ -227,14 +227,15 @@ fn check_connectivity( } Ok(_) => { *outbound_healthy_v4 = true; - break; } - Err(e) if e.kind() == io::ErrorKind::WouldBlock => {} + Err(e) if e.kind() == io::ErrorKind::WouldBlock => continue, Err(e) => { eprintln!("[warn] IPv4: read: {}", e); *outbound_healthy_v4 = false; } } + + break; } conn4.shutdown(Shutdown::Both)?; @@ -264,14 +265,15 @@ fn check_connectivity( } Ok(_) => { *outbound_healthy_v6 = true; - break; } - Err(e) if e.kind() == io::ErrorKind::WouldBlock => {} + Err(e) if e.kind() == io::ErrorKind::WouldBlock => continue, Err(e) => { eprintln!("[warn] IPv6: read: {}", e); *outbound_healthy_v6 = false; } } + + break; } conn6.shutdown(Shutdown::Both)?; -- cgit v1.2.3