mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-16 08:31:35 +10:00
Add airtime of current received/transmitted packet to nextTx time of all pending retransmissions (#2309)
To avoid unnecessary retransmissions when sending them too early Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
@@ -24,6 +24,15 @@ ErrorCode ReliableRouter::send(meshtastic_MeshPacket *p)
|
||||
startRetransmission(copy);
|
||||
}
|
||||
|
||||
/* If we have pending retransmissions, add the airtime of this packet to it, because during that time we cannot receive an
|
||||
(implicit) ACK. Otherwise, we might retransmit too early.
|
||||
*/
|
||||
for (auto i = pending.begin(); i != pending.end(); i++) {
|
||||
if (i->first.id != p->id) {
|
||||
i->second.nextTxMsec += iface->getPacketTime(p);
|
||||
}
|
||||
}
|
||||
|
||||
return FloodingRouter::send(p);
|
||||
}
|
||||
|
||||
@@ -53,6 +62,15 @@ bool ReliableRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
||||
}
|
||||
}
|
||||
|
||||
/* At this point we have already deleted the pending retransmission if this packet was an (implicit) ACK to it.
|
||||
Now for all other pending retransmissions, we have to add the airtime of this received packet to the retransmission timer,
|
||||
because while receiving this packet, we could not have received an (implicit) ACK for it.
|
||||
If we don't add this, we will likely retransmit too early.
|
||||
*/
|
||||
for (auto i = pending.begin(); i != pending.end(); i++) {
|
||||
i->second.nextTxMsec += iface->getPacketTime(p);
|
||||
}
|
||||
|
||||
/* Resend implicit ACKs for repeated packets (assuming the original packet was sent with HOP_RELIABLE)
|
||||
* this way if an implicit ACK is dropped and a packet is resent we'll rebroadcast again.
|
||||
* Resending real ACKs is omitted, as you might receive a packet multiple times due to flooding and
|
||||
|
||||
Reference in New Issue
Block a user