From 0d87dcc989609d570ec06400b4f3f5a40fc8f74d Mon Sep 17 00:00:00 2001 From: Daniel Novak Date: Sun, 1 Mar 2026 07:39:43 +0100 Subject: [PATCH] Also fix countBefore(0xFFFFFFFF) to return _num The signed comparison in countBefore breaks for the max uint32_t value. Even though callers now use getOutboundTotal(), the function itself should be correct for all inputs. --- src/helpers/StaticPoolPacketManager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/helpers/StaticPoolPacketManager.cpp b/src/helpers/StaticPoolPacketManager.cpp index 7ef2dafa..b8926df0 100644 --- a/src/helpers/StaticPoolPacketManager.cpp +++ b/src/helpers/StaticPoolPacketManager.cpp @@ -9,6 +9,8 @@ PacketQueue::PacketQueue(int max_entries) { } int PacketQueue::countBefore(uint32_t now) const { + if (now == 0xFFFFFFFF) return _num; // sentinel: count all entries regardless of schedule + int n = 0; for (int j = 0; j < _num; j++) { if ((int32_t)(_schedule_table[j] - now) > 0) continue; // scheduled for future... ignore for now