mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-14 14:31:24 +00:00
NextHopRouter::roleAllowsCancelingFromTxQueue (same logic as FloodingRouter::roleAllowsCancelingDupe)
This commit is contained in:
parent
4ab125bbf7
commit
35340fc6e2
@ -161,6 +161,15 @@ bool NextHopRouter::stopRetransmission(NodeNum from, PacketId id)
|
|||||||
return stopRetransmission(key);
|
return stopRetransmission(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NextHopRouter::roleAllowsCancelingFromTxQueue(const meshtastic_MeshPacket *p)
|
||||||
|
{
|
||||||
|
// Return true if we're allowed to cancel a packet in the txQueue (so we may never transmit it even once)
|
||||||
|
|
||||||
|
// Return false for roles like ROUTER, REPEATER, ROUTER_LATE which should always transmit the packet at least once.
|
||||||
|
|
||||||
|
return roleAllowsCancelingDupe(p); // same logic as FloodingRouter::roleAllowsCancelingDupe
|
||||||
|
}
|
||||||
|
|
||||||
bool NextHopRouter::stopRetransmission(GlobalPacketId key)
|
bool NextHopRouter::stopRetransmission(GlobalPacketId key)
|
||||||
{
|
{
|
||||||
auto old = findPendingPacket(key);
|
auto old = findPendingPacket(key);
|
||||||
@ -170,9 +179,7 @@ bool NextHopRouter::stopRetransmission(GlobalPacketId key)
|
|||||||
to avoid canceling a transmission if it was ACKed super fast via MQTT */
|
to avoid canceling a transmission if it was ACKed super fast via MQTT */
|
||||||
if (old->numRetransmissions < NUM_RELIABLE_RETX - 1) {
|
if (old->numRetransmissions < NUM_RELIABLE_RETX - 1) {
|
||||||
// We only cancel it if we are the original sender or if we're not a router(_late)/repeater
|
// We only cancel it if we are the original sender or if we're not a router(_late)/repeater
|
||||||
if (isFromUs(p) || (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER &&
|
if (isFromUs(p) || roleAllowsCancelingFromTxQueue(p)) {
|
||||||
config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER &&
|
|
||||||
config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER_LATE)) {
|
|
||||||
// remove the 'original' (identified by originator and packet->id) from the txqueue and free it
|
// remove the 'original' (identified by originator and packet->id) from the txqueue and free it
|
||||||
cancelSending(getFrom(p), p->id);
|
cancelSending(getFrom(p), p->id);
|
||||||
// now free the pooled copy for retransmission too
|
// now free the pooled copy for retransmission too
|
||||||
|
@ -121,6 +121,9 @@ class NextHopRouter : public FloodingRouter
|
|||||||
*/
|
*/
|
||||||
PendingPacket *startRetransmission(meshtastic_MeshPacket *p, uint8_t numReTx = NUM_INTERMEDIATE_RETX);
|
PendingPacket *startRetransmission(meshtastic_MeshPacket *p, uint8_t numReTx = NUM_INTERMEDIATE_RETX);
|
||||||
|
|
||||||
|
// Return true if we're allowed to cancel a packet in the txQueue (so we may never transmit it even once)
|
||||||
|
bool roleAllowsCancelingFromTxQueue(const meshtastic_MeshPacket *p);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop any retransmissions we are doing of the specified node/packet ID pair
|
* Stop any retransmissions we are doing of the specified node/packet ID pair
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user