mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
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.
This commit is contained in:
parent
c7568a8db0
commit
0d87dcc989
1 changed files with 2 additions and 0 deletions
|
|
@ -9,6 +9,8 @@ PacketQueue::PacketQueue(int max_entries) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int PacketQueue::countBefore(uint32_t now) const {
|
int PacketQueue::countBefore(uint32_t now) const {
|
||||||
|
if (now == 0xFFFFFFFF) return _num; // sentinel: count all entries regardless of schedule
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (int j = 0; j < _num; j++) {
|
for (int j = 0; j < _num; j++) {
|
||||||
if ((int32_t)(_schedule_table[j] - now) > 0) continue; // scheduled for future... ignore for now
|
if ((int32_t)(_schedule_table[j] - now) > 0) continue; // scheduled for future... ignore for now
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue