mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-23 17:13:38 +00:00
add want_ack support for broadcast packets
This commit is contained in:
parent
0271df0657
commit
e2cbccb133
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
great source of papers and class notes: http://www.cs.jhu.edu/~cs647/
|
great source of papers and class notes: http://www.cs.jhu.edu/~cs647/
|
||||||
|
|
||||||
|
flood routing improvements
|
||||||
|
|
||||||
|
- DONE if we don't see anyone rebroadcast our want_ack=true broadcasts, retry as needed.
|
||||||
|
|
||||||
reliable messaging tasks (stage one for DSR):
|
reliable messaging tasks (stage one for DSR):
|
||||||
|
|
||||||
- DONE generalize naive flooding
|
- DONE generalize naive flooding
|
||||||
@ -19,9 +23,6 @@ reliable messaging tasks (stage one for DSR):
|
|||||||
|
|
||||||
dsr tasks
|
dsr tasks
|
||||||
|
|
||||||
- do "hop by hop" routing
|
|
||||||
- when sending, if destnodeinfo.next_hop is zero (and no message is already waiting for an arp for that node), startRouteDiscovery() for that node. Queue the message in the 'waiting for arp queue' so we can send it later when then the arp completes.
|
|
||||||
- otherwise, use next_hop and start sending a message (with ack request) towards that node.
|
|
||||||
- Don't use broadcasts for the network pings (close open github issue)
|
- Don't use broadcasts for the network pings (close open github issue)
|
||||||
- add ignoreSenders to radioconfig to allow testing different mesh topologies by refusing to see certain senders
|
- add ignoreSenders to radioconfig to allow testing different mesh topologies by refusing to see certain senders
|
||||||
- test multihop delivery with the python framework
|
- test multihop delivery with the python framework
|
||||||
@ -34,6 +35,12 @@ optimizations / low priority:
|
|||||||
- handle 51 day rollover in doRetransmissions
|
- handle 51 day rollover in doRetransmissions
|
||||||
- use a priority queue for the messages waiting to send. Send acks first, then routing messages, then data messages, then broadcasts?
|
- use a priority queue for the messages waiting to send. Send acks first, then routing messages, then data messages, then broadcasts?
|
||||||
|
|
||||||
|
when we send a packet
|
||||||
|
|
||||||
|
- do "hop by hop" routing
|
||||||
|
- when sending, if destnodeinfo.next_hop is zero (and no message is already waiting for an arp for that node), startRouteDiscovery() for that node. Queue the message in the 'waiting for arp queue' so we can send it later when then the arp completes.
|
||||||
|
- otherwise, use next_hop and start sending a message (with ack request) towards that node (starting with next_hop).
|
||||||
|
|
||||||
when we receive any packet
|
when we receive any packet
|
||||||
|
|
||||||
- sniff and update tables (especially useful to find adjacent nodes). Update user, network and position info.
|
- sniff and update tables (especially useful to find adjacent nodes). Update user, network and position info.
|
||||||
@ -47,13 +54,13 @@ routeDiscovery
|
|||||||
- if we've already passed through us (or is from us), then it ignore it
|
- if we've already passed through us (or is from us), then it ignore it
|
||||||
- use the nodes already mentioned in the request to update our routing table
|
- use the nodes already mentioned in the request to update our routing table
|
||||||
- if they were looking for us, send back a routereply
|
- if they were looking for us, send back a routereply
|
||||||
- if max_hops is zero and they weren't looking for us, drop (FIXME, send back error - I think not though?)
|
- NOT DOING FOR NOW -if max_hops is zero and they weren't looking for us, drop (FIXME, send back error - I think not though?)
|
||||||
- if we receive a discovery packet, we use it to populate next_hop (if needed) towards the requester (after decrementing max_hops)
|
- if we receive a discovery packet, and we don't have next_hop set in our nodedb, we use it to populate next_hop (if needed) towards the requester (after decrementing max_hops)
|
||||||
- if we receive a discovery packet, and we have a next_hop in our nodedb for that destination we send a (reliable) we send a route reply towards the requester
|
- if we receive a discovery packet, and we have a next_hop in our nodedb for that destination we send a (reliable) we send a route reply towards the requester
|
||||||
|
|
||||||
when sending any reliable packet
|
when sending any reliable packet
|
||||||
|
|
||||||
- if we get back a nak, send a routeError message back towards the original requester. all nodes eavesdrop on that packet and update their route caches
|
- if timeout doing retries, send a routeError (nak) message back towards the original requester. all nodes eavesdrop on that packet and update their route caches.
|
||||||
|
|
||||||
when we receive a routereply packet
|
when we receive a routereply packet
|
||||||
|
|
||||||
|
2
proto
2
proto
@ -1 +1 @@
|
|||||||
Subproject commit e095ea92e62edc3f5dd6864c3d08d113fd8842e2
|
Subproject commit bfae47bdc0da23bb1e53fed054d3de2d161389bc
|
@ -11,7 +11,7 @@ FloodingRouter::FloodingRouter() {}
|
|||||||
*/
|
*/
|
||||||
ErrorCode FloodingRouter::send(MeshPacket *p)
|
ErrorCode FloodingRouter::send(MeshPacket *p)
|
||||||
{
|
{
|
||||||
// Add any messages _we_ send to the seen message list
|
// Add any messages _we_ send to the seen message list (so we will ignore all retransmissions we see)
|
||||||
wasSeenRecently(p); // FIXME, move this to a sniffSent method
|
wasSeenRecently(p); // FIXME, move this to a sniffSent method
|
||||||
|
|
||||||
return Router::send(p);
|
return Router::send(p);
|
||||||
|
@ -33,7 +33,17 @@ ErrorCode ReliableRouter::send(MeshPacket *p)
|
|||||||
*/
|
*/
|
||||||
void ReliableRouter::handleReceived(MeshPacket *p)
|
void ReliableRouter::handleReceived(MeshPacket *p)
|
||||||
{
|
{
|
||||||
if (p->to == getNodeNum()) { // ignore ack/nak/want_ack packets that are not address to us (for now)
|
NodeNum ourNode = getNodeNum();
|
||||||
|
|
||||||
|
if (p->from == ourNode && p->to == NODENUM_BROADCAST) {
|
||||||
|
// We are seeing someone rebroadcast one of our broadcast attempts.
|
||||||
|
// If this is the first time we saw this, cancel any retransmissions we have queued up and generate an internal ack for
|
||||||
|
// the original sending process.
|
||||||
|
if (stopRetransmission(p->from, p->id)) {
|
||||||
|
DEBUG_MSG("Someone is retransmitting for us, generate implicit ack");
|
||||||
|
sendAckNak(true, p->from, p->id);
|
||||||
|
}
|
||||||
|
} else if (p->to == ourNode) { // ignore ack/nak/want_ack packets that are not address to us (for now)
|
||||||
if (p->want_ack) {
|
if (p->want_ack) {
|
||||||
sendAckNak(true, p->from, p->id);
|
sendAckNak(true, p->from, p->id);
|
||||||
}
|
}
|
||||||
@ -95,20 +105,22 @@ PendingPacket::PendingPacket(MeshPacket *p)
|
|||||||
/**
|
/**
|
||||||
* Stop any retransmissions we are doing of the specified node/packet ID pair
|
* Stop any retransmissions we are doing of the specified node/packet ID pair
|
||||||
*/
|
*/
|
||||||
void ReliableRouter::stopRetransmission(NodeNum from, PacketId id)
|
bool ReliableRouter::stopRetransmission(NodeNum from, PacketId id)
|
||||||
{
|
{
|
||||||
auto key = GlobalPacketId(from, id);
|
auto key = GlobalPacketId(from, id);
|
||||||
stopRetransmission(key);
|
stopRetransmission(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReliableRouter::stopRetransmission(GlobalPacketId key)
|
bool ReliableRouter::stopRetransmission(GlobalPacketId key)
|
||||||
{
|
{
|
||||||
auto old = pending.find(key); // If we have an old record, someone messed up because id got reused
|
auto old = pending.find(key); // If we have an old record, someone messed up because id got reused
|
||||||
if (old != pending.end()) {
|
if (old != pending.end()) {
|
||||||
auto numErased = pending.erase(key);
|
auto numErased = pending.erase(key);
|
||||||
assert(numErased == 1);
|
assert(numErased == 1);
|
||||||
packetPool.release(old->second.packet);
|
packetPool.release(old->second.packet);
|
||||||
}
|
return true;
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting.
|
* Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting.
|
||||||
|
@ -39,6 +39,12 @@ struct PendingPacket {
|
|||||||
/** Starts at NUM_RETRANSMISSIONS -1(normally 3) and counts down. Once zero it will be removed from the list */
|
/** Starts at NUM_RETRANSMISSIONS -1(normally 3) and counts down. Once zero it will be removed from the list */
|
||||||
uint8_t numRetransmissions;
|
uint8_t numRetransmissions;
|
||||||
|
|
||||||
|
/** True if we have started trying to find a route - for DSR usage
|
||||||
|
* While trying to find a route we don't actually send the data packet. We just leave it here pending until
|
||||||
|
* we have a route or we've failed to find one.
|
||||||
|
*/
|
||||||
|
bool wantRoute = false;
|
||||||
|
|
||||||
PendingPacket() {}
|
PendingPacket() {}
|
||||||
PendingPacket(MeshPacket *p);
|
PendingPacket(MeshPacket *p);
|
||||||
|
|
||||||
@ -98,9 +104,11 @@ class ReliableRouter : public FloodingRouter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop any retransmissions we are doing of the specified node/packet ID pair
|
* Stop any retransmissions we are doing of the specified node/packet ID pair
|
||||||
|
*
|
||||||
|
* @return true if we found and removed a transmission with this ID
|
||||||
*/
|
*/
|
||||||
void stopRetransmission(NodeNum from, PacketId id);
|
bool stopRetransmission(NodeNum from, PacketId id);
|
||||||
void stopRetransmission(GlobalPacketId p);
|
bool stopRetransmission(GlobalPacketId p);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting.
|
* Add p to the list of packets to retransmit occasionally. We will free it once we stop retransmitting.
|
||||||
|
Loading…
Reference in New Issue
Block a user