mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-25 06:12:29 +00:00
Drop packets if toPhoneQueue
is full, unless it's text/RangeTest (#2918)
This commit is contained in:
parent
4052194dfe
commit
8b8fffda81
@ -267,14 +267,22 @@ void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
|
|||||||
|
|
||||||
void MeshService::sendToPhone(meshtastic_MeshPacket *p)
|
void MeshService::sendToPhone(meshtastic_MeshPacket *p)
|
||||||
{
|
{
|
||||||
|
perhapsDecode(p);
|
||||||
|
|
||||||
if (toPhoneQueue.numFree() == 0) {
|
if (toPhoneQueue.numFree() == 0) {
|
||||||
|
if (p->decoded.portnum == meshtastic_PortNum_TEXT_MESSAGE_APP ||
|
||||||
|
p->decoded.portnum == meshtastic_PortNum_RANGE_TEST_APP) {
|
||||||
LOG_WARN("ToPhone queue is full, discarding oldest\n");
|
LOG_WARN("ToPhone queue is full, discarding oldest\n");
|
||||||
meshtastic_MeshPacket *d = toPhoneQueue.dequeuePtr(0);
|
meshtastic_MeshPacket *d = toPhoneQueue.dequeuePtr(0);
|
||||||
if (d)
|
if (d)
|
||||||
releaseToPool(d);
|
releaseToPool(d);
|
||||||
|
} else {
|
||||||
|
LOG_WARN("ToPhone queue is full, dropping packet.\n");
|
||||||
|
releaseToPool(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
perhapsDecode(p);
|
|
||||||
assert(toPhoneQueue.enqueue(p, 0));
|
assert(toPhoneQueue.enqueue(p, 0));
|
||||||
fromNum++;
|
fromNum++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user