fix repeater loop for I_FIND_PARENT
A repeater calls findParentNode() inside process() when receives a I_FIND_PARENT and nc.distance is invalid, this could cause a loop
This commit is contained in:
@@ -302,6 +302,12 @@ void MySensor::setupNode() {
|
||||
}
|
||||
|
||||
void MySensor::findParentNode() {
|
||||
static boolean findingParentNode = false;
|
||||
|
||||
if (findingParentNode)
|
||||
return;
|
||||
findingParentNode = true;
|
||||
|
||||
failedTransmissions = 0;
|
||||
|
||||
// Set distance to max
|
||||
@@ -316,6 +322,7 @@ void MySensor::findParentNode() {
|
||||
|
||||
// Wait for ping response.
|
||||
wait(2000);
|
||||
findingParentNode = false;
|
||||
}
|
||||
|
||||
boolean MySensor::sendRoute(MyMessage &message) {
|
||||
|
||||
Reference in New Issue
Block a user