issue 879 - changes to Router.cpp

This commit is contained in:
a-f-G-U-C 2021-10-09 13:54:42 +00:00 committed by GitHub
parent ee9c72b8c7
commit 5eb2e6401f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -161,7 +161,7 @@ ErrorCode Router::sendLocal(MeshPacket *p)
// If we are sending a broadcast, we also treat it as if we just received it ourself
// this allows local apps (and PCs) to see broadcasts sourced locally
if (p->to == NODENUM_BROADCAST) {
handleReceived(p);
handleReceived(p, RX_SRC_LOCAL);
}
return send(p);
@ -324,7 +324,7 @@ NodeNum Router::getNodeNum()
* Handle any packet that is received by an interface on this node.
* Note: some packets may merely being passed through this node and will be forwarded elsewhere.
*/
void Router::handleReceived(MeshPacket *p)
void Router::handleReceived(MeshPacket *p, RxSource src)
{
// Also, we should set the time from the ISR and it should have msec level resolution
p->rx_time = getValidTime(RTCQualityFromNet); // store the arrival timestamp for the phone
@ -333,13 +333,16 @@ void Router::handleReceived(MeshPacket *p)
bool decoded = perhapsDecode(p);
if (decoded) {
// parsing was successful, queue for our recipient
printPacket("handleReceived", p);
if (src == RX_SRC_LOCAL)
printPacket("handleReceived(local)", p);
else
printPacket("handleReceived(remote)", p);
} else {
printPacket("packet decoding failed (no PSK?)", p);
}
// call plugins here
MeshPlugin::callPlugins(*p);
MeshPlugin::callPlugins(*p, src);
}
void Router::perhapsHandleReceived(MeshPacket *p)

View File

@ -122,7 +122,7 @@ class Router : protected concurrency::OSThread
* Note: this packet will never be called for messages sent/generated by this node.
* Note: this method will free the provided packet.
*/
void handleReceived(MeshPacket *p);
void handleReceived(MeshPacket *p, RxSource src = RX_SRC_RADIO);
/** Frees the provided packet, and generates a NAK indicating the speicifed error while sending */
void abortSendAndNak(Routing_Error err, MeshPacket *p);