mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Fix packet pool leak when rx queue is full
PacketQueue::add() silently dropped packets when the queue was at capacity. The packet pointer was lost — never enqueued, never returned to the unused pool. Each occurrence permanently shrank the 32-packet pool until allocNew() returned NULL and the node went deaf. Return bool from add() and free the packet back to the pool on failure.
This commit is contained in:
parent
bbc5f0c11a
commit
ffc9815e9a
2 changed files with 12 additions and 6 deletions
|
|
@ -11,7 +11,7 @@ class PacketQueue {
|
|||
public:
|
||||
PacketQueue(int max_entries);
|
||||
mesh::Packet* get(uint32_t now);
|
||||
void add(mesh::Packet* packet, uint8_t priority, uint32_t scheduled_for);
|
||||
bool add(mesh::Packet* packet, uint8_t priority, uint32_t scheduled_for);
|
||||
int count() const { return _num; }
|
||||
int countBefore(uint32_t now) const;
|
||||
mesh::Packet* itemAt(int i) const { return _table[i]; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue