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:
Marcelo Aquino
2015-07-09 14:19:57 -03:00
parent f6dbdcf06c
commit fcb92436d9
+7
View File
@@ -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) {