mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-25 06:20:23 +00:00
Revert perhapsRebroadcast()
This commit is contained in:
parent
28944adf20
commit
790801f8e7
@ -21,28 +21,15 @@ ErrorCode FloodingRouter::send(meshtastic_MeshPacket *p)
|
|||||||
|
|
||||||
bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
||||||
{
|
{
|
||||||
/* Resend implicit ACKs for repeated packets (hopStart equals hopLimit);
|
|
||||||
* 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
|
|
||||||
* flooding this ACK back to the original sender already adds redundancy. */
|
|
||||||
bool isRepeated = p->hop_start > 0 && (p->hop_start == p->hop_limit);
|
|
||||||
bool didRebroadcast = false;
|
|
||||||
if (wasSeenRecently(p, false) && isRepeated) {
|
|
||||||
LOG_DEBUG("Repeated floodmsg");
|
|
||||||
didRebroadcast = perhapsRebroadcast(p); // perhaps rebroadcast the packet
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wasSeenRecently(p)) { // Note: this will also add a recent packet record
|
if (wasSeenRecently(p)) { // Note: this will also add a recent packet record
|
||||||
printPacket("Ignore dupe incoming msg", p);
|
printPacket("Ignore dupe incoming msg", p);
|
||||||
rxDupe++;
|
rxDupe++;
|
||||||
if (!didRebroadcast) { // We shouldn't cancel a rebroadcast that we just did
|
|
||||||
if (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER &&
|
if (config.device.role != meshtastic_Config_DeviceConfig_Role_ROUTER &&
|
||||||
config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
config.device.role != meshtastic_Config_DeviceConfig_Role_REPEATER) {
|
||||||
// cancel rebroadcast of this message *if* there was already one, unless we're a router/repeater!
|
// cancel rebroadcast of this message *if* there was already one, unless we're a router/repeater!
|
||||||
if (Router::cancelSending(p->from, p->id))
|
if (Router::cancelSending(p->from, p->id))
|
||||||
txRelayCanceled++;
|
txRelayCanceled++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,14 +50,6 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
|||||||
LOG_DEBUG("Rxd an ACK/reply not for me, cancel rebroadcast");
|
LOG_DEBUG("Rxd an ACK/reply not for me, cancel rebroadcast");
|
||||||
Router::cancelSending(p->to, p->decoded.request_id); // cancel rebroadcast for this DM
|
Router::cancelSending(p->to, p->decoded.request_id); // cancel rebroadcast for this DM
|
||||||
}
|
}
|
||||||
perhapsRebroadcast(p);
|
|
||||||
|
|
||||||
// handle the packet as normal
|
|
||||||
Router::sniffReceived(p, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FloodingRouter::perhapsRebroadcast(const meshtastic_MeshPacket *p)
|
|
||||||
{
|
|
||||||
if (!isToUs(p) && (p->hop_limit > 0) && !isFromUs(p)) {
|
if (!isToUs(p) && (p->hop_limit > 0) && !isFromUs(p)) {
|
||||||
if (p->id != 0) {
|
if (p->id != 0) {
|
||||||
if (isRebroadcaster()) {
|
if (isRebroadcaster()) {
|
||||||
@ -89,8 +68,6 @@ bool FloodingRouter::perhapsRebroadcast(const meshtastic_MeshPacket *p)
|
|||||||
// Note: we are careful to resend using the original senders node id
|
// Note: we are careful to resend using the original senders node id
|
||||||
// We are careful not to call our hooked version of send() - because we don't want to check this again
|
// We are careful not to call our hooked version of send() - because we don't want to check this again
|
||||||
Router::send(tosend);
|
Router::send(tosend);
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
} else {
|
||||||
LOG_DEBUG("No rebroadcast: Role = CLIENT_MUTE or Rebroadcast Mode = NONE");
|
LOG_DEBUG("No rebroadcast: Role = CLIENT_MUTE or Rebroadcast Mode = NONE");
|
||||||
}
|
}
|
||||||
@ -98,6 +75,6 @@ bool FloodingRouter::perhapsRebroadcast(const meshtastic_MeshPacket *p)
|
|||||||
LOG_DEBUG("Ignore 0 id broadcast");
|
LOG_DEBUG("Ignore 0 id broadcast");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// handle the packet as normal
|
||||||
return false;
|
Router::sniffReceived(p, c);
|
||||||
}
|
}
|
@ -29,10 +29,6 @@
|
|||||||
class FloodingRouter : public Router, protected PacketHistory
|
class FloodingRouter : public Router, protected PacketHistory
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/** Check if we should rebroadcast this packet, and do so if needed
|
|
||||||
* @return true if rebroadcasted */
|
|
||||||
bool perhapsRebroadcast(const meshtastic_MeshPacket *p);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
Loading…
Reference in New Issue
Block a user