Replace 0xFFFFFFFF sentinel with explicit getOutboundTotal()

Instead of overloading getOutboundCount() with a magic sentinel value,
add a dedicated getOutboundTotal() method to the PacketManager interface
that returns the total queue size without time filtering.

This eliminates the fragile convention that caused the regression and
makes the two operations — time-filtered count vs total count —
explicitly separate in the API.
This commit is contained in:
Daniel Novak
2026-02-28 17:19:04 +01:00
parent c436bd42c5
commit c7568a8db0
7 changed files with 13 additions and 8 deletions
+4 -1
View File
@@ -9,7 +9,6 @@ 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
@@ -98,6 +97,10 @@ int StaticPoolPacketManager::getOutboundCount(uint32_t now) const {
return send_queue.countBefore(now);
}
int StaticPoolPacketManager::getOutboundTotal() const {
return send_queue.count();
}
int StaticPoolPacketManager::getFreeCount() const {
return unused.count();
}