mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
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:
parent
c436bd42c5
commit
c7568a8db0
7 changed files with 13 additions and 8 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue