From 8b6366f25862016e2654c0a0a8343e3e8e85b656 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=B2=20Caruso?= <niccolo.caruso@skywarder.eu>
Date: Fri, 24 Jan 2025 14:39:59 +0100
Subject: [PATCH] [WIZ5500, FIX] Fixed timeout was not checked

A timeout check was missing, therefore if no timeout was used, it skipped the loop
---
 src/shared/drivers/WIZ5500/WIZ5500.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/shared/drivers/WIZ5500/WIZ5500.cpp b/src/shared/drivers/WIZ5500/WIZ5500.cpp
index bf272bb5f..b9cc3f053 100644
--- a/src/shared/drivers/WIZ5500/WIZ5500.cpp
+++ b/src/shared/drivers/WIZ5500/WIZ5500.cpp
@@ -487,7 +487,8 @@ int Wiz5500::waitForSocketIrq(miosix::Lock<miosix::FastMutex>& l, int sock_n,
 
     while (interrupt_service_thread == this_thread)
     {
-        if (Kernel::getOldTick() > start + timeout)
+        // In case of no timeout or expired timeout
+        if (timeout != -1 && Kernel::getOldTick() > start + timeout)
             break;
 
         // Run a single step of the ISR
-- 
GitLab