diff --git a/src/Dispatcher.h b/src/Dispatcher.h index 0a448c40..7ecee1a4 100644 --- a/src/Dispatcher.h +++ b/src/Dispatcher.h @@ -89,7 +89,7 @@ public: virtual void queueOutbound(Packet* packet, uint8_t priority, uint32_t scheduled_for) = 0; virtual Packet* getNextOutbound(uint32_t now) = 0; // by priority - virtual int getOutboundCount(uint32_t now) const = 0; + virtual int getOutboundCount(uint32_t now) const = 0; // pass now=0xFFFFFFFF to count all virtual int getFreeCount() const = 0; virtual Packet* getOutboundByIdx(int i) = 0; virtual Packet* removeOutboundByIdx(int i) = 0; diff --git a/src/helpers/StaticPoolPacketManager.cpp b/src/helpers/StaticPoolPacketManager.cpp index 67d63979..c89d5088 100644 --- a/src/helpers/StaticPoolPacketManager.cpp +++ b/src/helpers/StaticPoolPacketManager.cpp @@ -9,6 +9,7 @@ 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 diff --git a/src/helpers/StaticPoolPacketManager.h b/src/helpers/StaticPoolPacketManager.h index 52c299db..bcc5deb9 100644 --- a/src/helpers/StaticPoolPacketManager.h +++ b/src/helpers/StaticPoolPacketManager.h @@ -13,7 +13,7 @@ public: mesh::Packet* get(uint32_t now); bool add(mesh::Packet* packet, uint8_t priority, uint32_t scheduled_for); int count() const { return _num; } - int countBefore(uint32_t now) const; + int countBefore(uint32_t now) const; // pass now=0xFFFFFFFF to count all mesh::Packet* itemAt(int i) const { return _table[i]; } mesh::Packet* removeByIdx(int i); };