Skip to content

Commit

Permalink
make sure the queue stays in te same order
Browse files Browse the repository at this point in the history
the memory pool can NOT be iterated easily, since it's not a linear object.
  • Loading branch information
caveman99 committed Dec 11, 2023
1 parent 385b29c commit d952da8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mesh/MeshService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ NodeNum MeshService::getNodenumFromRequestId(uint32_t request_id)
NodeNum nodenum = 0;
for (int i = 0; i < toPhoneQueue.numUsed(); i++) {
meshtastic_MeshPacket *p = toPhoneQueue.dequeuePtr(0);
// put it right back on the queue
toPhoneQueue.enqueue(p, 0);
if (p->id == request_id) {
nodenum = p->to;
break;
// make sure to continue this to make one full loop
}
// put it right back on the queue
toPhoneQueue.enqueue(p, 0);
}
return nodenum;
}
Expand Down

0 comments on commit d952da8

Please sign in to comment.