Prep work for better Store and Forward (#8999)
* make channels.h getHash public * router.* make the encrypted packet copy available for modules to access * Update src/mesh/Router.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Set p_encrypted to nullptr after release --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
GitHub
Copilot
parent
96c42229b0
commit
5b299f3ede
+2
-2
@@ -96,6 +96,8 @@ class Channels
|
|||||||
|
|
||||||
bool setDefaultPresetCryptoForHash(ChannelHash channelHash);
|
bool setDefaultPresetCryptoForHash(ChannelHash channelHash);
|
||||||
|
|
||||||
|
int16_t getHash(ChannelIndex i) { return hashes[i]; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Given a channel index, change to use the crypto key specified by that index
|
/** Given a channel index, change to use the crypto key specified by that index
|
||||||
*
|
*
|
||||||
@@ -113,8 +115,6 @@ class Channels
|
|||||||
*/
|
*/
|
||||||
int16_t generateHash(ChannelIndex channelNum);
|
int16_t generateHash(ChannelIndex channelNum);
|
||||||
|
|
||||||
int16_t getHash(ChannelIndex i) { return hashes[i]; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a channel, fixing any errors as needed
|
* Validate a channel, fixing any errors as needed
|
||||||
*/
|
*/
|
||||||
|
|||||||
+2
-1
@@ -692,7 +692,7 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
|
|||||||
|
|
||||||
// Store a copy of encrypted packet for MQTT
|
// Store a copy of encrypted packet for MQTT
|
||||||
DEBUG_HEAP_BEFORE;
|
DEBUG_HEAP_BEFORE;
|
||||||
meshtastic_MeshPacket *p_encrypted = packetPool.allocCopy(*p);
|
p_encrypted = packetPool.allocCopy(*p);
|
||||||
DEBUG_HEAP_AFTER("Router::handleReceived", p_encrypted);
|
DEBUG_HEAP_AFTER("Router::handleReceived", p_encrypted);
|
||||||
|
|
||||||
// Take those raw bytes and convert them back into a well structured protobuf we can understand
|
// Take those raw bytes and convert them back into a well structured protobuf we can understand
|
||||||
@@ -758,6 +758,7 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
packetPool.release(p_encrypted); // Release the encrypted packet
|
packetPool.release(p_encrypted); // Release the encrypted packet
|
||||||
|
p_encrypted = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)
|
void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)
|
||||||
|
|||||||
@@ -91,6 +91,9 @@ class Router : protected concurrency::OSThread, protected PacketHistory
|
|||||||
before us */
|
before us */
|
||||||
uint32_t rxDupe = 0, txRelayCanceled = 0;
|
uint32_t rxDupe = 0, txRelayCanceled = 0;
|
||||||
|
|
||||||
|
// pointer to the encrypted packet
|
||||||
|
meshtastic_MeshPacket *p_encrypted = nullptr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class RoutingModule;
|
friend class RoutingModule;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user