mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-04 09:02:21 +00:00
DSR WIP
This commit is contained in:
@@ -38,9 +38,26 @@ when we receive a routeError packet
|
||||
|
||||
ErrorCode DSRRouter::send(MeshPacket *p)
|
||||
{
|
||||
// If we have an entry in our routing tables, just send it, otherwise start a route discovery
|
||||
// We only consider multihop routing packets (i.e. those with dest set)
|
||||
if (p->decoded.dest) {
|
||||
// add an entry for this pending message
|
||||
auto pending = startRetransmission(p);
|
||||
// FIXME - when acks come in for this packet, we should _not_ delete the record unless the ack was from
|
||||
// the final dest. We need to keep that record around until FIXME
|
||||
// Also we should not retransmit multihop entries in that table at all
|
||||
|
||||
return ReliableRouter::send(p);
|
||||
// If we have an entry in our routing tables, just send it, otherwise start a route discovery
|
||||
NodeNum nextHop = getNextHop(p->decoded.dest);
|
||||
if (nextHop) {
|
||||
sendNextHop(nextHop, p); // start a reliable single hop send
|
||||
} else {
|
||||
pending->wantRoute = true;
|
||||
|
||||
// start discovery, but only if we don't already a discovery in progress for that node number
|
||||
startDiscovery(p->decoded.dest);
|
||||
}
|
||||
} else
|
||||
return ReliableRouter::send(p);
|
||||
}
|
||||
|
||||
void DSRRouter::sniffReceived(const MeshPacket *p)
|
||||
|
||||
@@ -146,13 +146,15 @@ bool ReliableRouter::stopRetransmission(GlobalPacketId key)
|
||||
/**
|
||||
* Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting.
|
||||
*/
|
||||
void ReliableRouter::startRetransmission(MeshPacket *p)
|
||||
PendingPacket *ReliableRouter::startRetransmission(MeshPacket *p)
|
||||
{
|
||||
auto id = GlobalPacketId(p);
|
||||
auto rec = PendingPacket(p);
|
||||
|
||||
stopRetransmission(p->from, p->id);
|
||||
pending[id] = rec;
|
||||
|
||||
return &pending[id];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -103,6 +103,11 @@ class ReliableRouter : public FloodingRouter
|
||||
*/
|
||||
virtual bool shouldFilterReceived(const MeshPacket *p);
|
||||
|
||||
/**
|
||||
* Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting.
|
||||
*/
|
||||
PendingPacket *startRetransmission(MeshPacket *p);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Send an ack or a nak packet back towards whoever sent idFrom
|
||||
@@ -117,11 +122,6 @@ class ReliableRouter : public FloodingRouter
|
||||
bool stopRetransmission(NodeNum from, PacketId id);
|
||||
bool stopRetransmission(GlobalPacketId p);
|
||||
|
||||
/**
|
||||
* Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting.
|
||||
*/
|
||||
void startRetransmission(MeshPacket *p);
|
||||
|
||||
/**
|
||||
* Do any retransmissions that are scheduled (FIXME - for the time being called from loop)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user