Improve repeater alerts and delivery reliability
This commit is contained in:
1 parent
da00a00436
commit
5a2aa592ea
13 files changed
+338
-23
No files matched your search
@@ -51,6 +51,19 @@ class RxReservePacketManager : public StaticPoolPacketManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
void expireStaleOutbound(uint32_t now) {
|
||||
for (int i = getOutboundTotal() - 1; i >= 0; i--) {
|
||||
mesh::Packet* pkt = getOutboundByIdx(i);
|
||||
uint32_t scheduled_for;
|
||||
if (pkt && lookupAge(pkt, &scheduled_for)
|
||||
&& (int32_t)(now - scheduled_for) > (int32_t)STALE_OUTBOUND_MS) {
|
||||
MESH_DEBUG_PRINTLN("RxReservePacketManager: dropping stale queued outbound");
|
||||
removeOutboundByIdx(i);
|
||||
free(pkt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
RxReservePacketManager(int pool_size, int rx_reserve)
|
||||
: StaticPoolPacketManager(pool_size), _rx_reserve(rx_reserve),
|
||||
@@ -73,19 +86,17 @@ public:
|
||||
}
|
||||
|
||||
mesh::Packet* getNextOutbound(uint32_t now) override {
|
||||
// Expire queued packets that have waited too long past their scheduled time.
|
||||
for (int i = getOutboundTotal() - 1; i >= 0; i--) {
|
||||
mesh::Packet* pkt = getOutboundByIdx(i);
|
||||
uint32_t scheduled_for;
|
||||
if (pkt && lookupAge(pkt, &scheduled_for)
|
||||
&& (int32_t)(now - scheduled_for) > (int32_t)STALE_OUTBOUND_MS) {
|
||||
MESH_DEBUG_PRINTLN("RxReservePacketManager: dropping stale queued outbound");
|
||||
removeOutboundByIdx(i);
|
||||
free(pkt);
|
||||
}
|
||||
}
|
||||
expireStaleOutbound(now);
|
||||
return StaticPoolPacketManager::getNextOutbound(now);
|
||||
}
|
||||
|
||||
|
||||
mesh::Packet* peekNextOutbound(uint32_t now) override {
|
||||
// Dispatcher chooses active/passive channel sensing from this pointer, so
|
||||
// apply the same expiry policy as getNextOutbound() before exposing it.
|
||||
expireStaleOutbound(now);
|
||||
return StaticPoolPacketManager::peekNextOutbound(now);
|
||||
}
|
||||
};
|
||||
|
||||
// The packet manager for an app build: observer builds reserve a quarter of the pool
|
||||
|
||||
Reference in new issue
Block a user