pull/145/head
geeksville 2020-05-23 12:50:33 -07:00
rodzic 16812c3ee4
commit e89fe2f7d9
2 zmienionych plików z 18 dodań i 0 usunięć

Wyświetl plik

@ -73,6 +73,15 @@ void DSRRouter::sniffReceived(const MeshPacket *p)
updateRoutes(p->decoded.reply, true); updateRoutes(p->decoded.reply, true);
} }
// Learn 0 hop routes by just hearing any adjacent nodes
// But treat broadcasts carefully, because when flood broadcasts go out they keep the same original "from". So we want to
// ignore rebroadcasts.
if (p->to != NODENUM_BROADCAST || p->hop_limit != HOP_RELIABLE) {
setRoute(p->from, p->from, 0); // We are adjacent with zero hops
}
// FIXME - handle any naks we receive (either because they are passing by us or someone naked a message we sent)
// Handle regular packets // Handle regular packets
if (p->to == getNodeNum()) { // Destined for us (at least for this hop) if (p->to == getNodeNum()) { // Destined for us (at least for this hop)
@ -80,6 +89,8 @@ void DSRRouter::sniffReceived(const MeshPacket *p)
if (p->decoded.dest && p->decoded.dest != p->to) { if (p->decoded.dest && p->decoded.dest != p->to) {
// FIXME if we have a route out, resend the packet to the next hop, otherwise return a nak with no-route available // FIXME if we have a route out, resend the packet to the next hop, otherwise return a nak with no-route available
} }
// FIXME - handle naks from our adjacent nodes - convert them to route error packets
} }
return ReliableRouter::sniffReceived(p); return ReliableRouter::sniffReceived(p);

Wyświetl plik

@ -36,4 +36,11 @@ class DSRRouter : public ReliableRouter
/** Not in our route cache, rebroadcast on their behalf (after adding ourselves to the request route) /** Not in our route cache, rebroadcast on their behalf (after adding ourselves to the request route)
*/ */
void resendRouteRequest(const MeshPacket *p); void resendRouteRequest(const MeshPacket *p);
/**
* Record that forwarder can reach dest for us, but they will need numHops to get there.
* If our routing tables already have something that can reach that node in fewer hops we will keep the existing route
* instead.
*/
void setRoute(NodeNum dest, NodeNum forwarder, uint8_t numHops);
}; };