mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-11 16:07:13 +00:00
Yank repeater module and just guard clause the alloc
This commit is contained in:
parent
e229a67d25
commit
103f1992dd
@ -84,7 +84,6 @@ class Router : protected concurrency::OSThread
|
||||
|
||||
protected:
|
||||
friend class RoutingModule;
|
||||
friend class RepeaterModule;
|
||||
|
||||
/**
|
||||
* Should this incoming filter be dropped?
|
||||
|
@ -82,9 +82,8 @@ void setupModules()
|
||||
|
||||
// NOTE! This module must be added LAST because it likes to check for replies from other modules and avoid sending extra
|
||||
// acks
|
||||
routingModule = new RoutingModule();
|
||||
} else {
|
||||
adminModule = new AdminModule();
|
||||
repeaterModule = new RepeaterModule();
|
||||
}
|
||||
routingModule = new RoutingModule();
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
#include "RepeaterModule.h"
|
||||
#include "MeshService.h"
|
||||
#include "NodeDB.h"
|
||||
#include "Router.h"
|
||||
#include "configuration.h"
|
||||
#include "main.h"
|
||||
|
||||
RepeaterModule *repeaterModule;
|
||||
|
||||
bool RepeaterModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Routing *r)
|
||||
{
|
||||
printPacket("Repeater observed message", &mp);
|
||||
router->sniffReceived(&mp, r);
|
||||
|
||||
if ((mp.to == NODENUM_BROADCAST || mp.to == nodeDB.getNodeNum()) && (mp.from != 0)) {
|
||||
printPacket("Delivering rx packet", &mp);
|
||||
service.handleFromRadio(&mp);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
meshtastic_MeshPacket *RepeaterModule::allocReply()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RepeaterModule::RepeaterModule() : ProtobufModule("repeater", meshtastic_PortNum_ROUTING_APP, &meshtastic_Routing_msg)
|
||||
{
|
||||
isPromiscuous = true;
|
||||
encryptedOk = true;
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
#pragma once
|
||||
#include "Channels.h"
|
||||
#include "ProtobufModule.h"
|
||||
|
||||
/**
|
||||
* Routing module for router control messages
|
||||
*/
|
||||
class RepeaterModule : public ProtobufModule<meshtastic_Routing>
|
||||
{
|
||||
public:
|
||||
/** Constructor
|
||||
* name is for debugging output
|
||||
*/
|
||||
RepeaterModule();
|
||||
|
||||
protected:
|
||||
friend class Router;
|
||||
|
||||
/** Called to handle a particular incoming message
|
||||
|
||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||
*/
|
||||
virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Routing *p) override;
|
||||
|
||||
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
||||
* so that subclasses can (optionally) send a response back to the original sender. */
|
||||
virtual meshtastic_MeshPacket *allocReply() override;
|
||||
|
||||
/// Override wantPacket to say we want to see all packets, not just those for our port number
|
||||
virtual bool wantPacket(const meshtastic_MeshPacket *p) override { return true; }
|
||||
};
|
||||
|
||||
extern RepeaterModule *repeaterModule;
|
@ -24,6 +24,8 @@ bool RoutingModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, mesh
|
||||
|
||||
meshtastic_MeshPacket *RoutingModule::allocReply()
|
||||
{
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_REPEATER)
|
||||
return NULL;
|
||||
assert(currentRequest);
|
||||
|
||||
// We only consider making replies if the request was a legit routing packet (not just something we were sniffing)
|
||||
|
Loading…
Reference in New Issue
Block a user