make shorter but more attempts to ping
This commit is contained in:
parent
24341e810b
commit
5305013065
@ -61,7 +61,7 @@ void DeviceMonitor::ping()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pingProcess->start("arping", {"-I", targetInterface.name(), "-f", "-w", "180", m_host->address()});
|
m_pingProcess->start("arping", {"-I", targetInterface.name(), "-f", "-w", "90", m_host->address()});
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceMonitor::arpLookupFinished(int exitCode)
|
void DeviceMonitor::arpLookupFinished(int exitCode)
|
||||||
@ -97,6 +97,7 @@ void DeviceMonitor::arpLookupFinished(int exitCode)
|
|||||||
}
|
}
|
||||||
// If we have a reachable entry, stop processing here
|
// If we have a reachable entry, stop processing here
|
||||||
needsPing = false;
|
needsPing = false;
|
||||||
|
m_failedPings = 0;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// ARP claims the device to be stale... Flagging device to require a ping.
|
// ARP claims the device to be stale... Flagging device to require a ping.
|
||||||
@ -138,9 +139,11 @@ void DeviceMonitor::pingFinished(int exitCode)
|
|||||||
emit reachableChanged(true);
|
emit reachableChanged(true);
|
||||||
}
|
}
|
||||||
emit seen();
|
emit seen();
|
||||||
|
m_failedPings = 0;
|
||||||
} else {
|
} else {
|
||||||
qCDebug(dcNetworkDetector()) << "Could not ping device" << m_host->macAddress() << m_host->address();
|
qCDebug(dcNetworkDetector()) << "Could not ping device" << m_host->macAddress() << m_host->address();
|
||||||
if (m_host->reachable()) {
|
m_failedPings++;
|
||||||
|
if (m_failedPings > 3 && m_host->reachable()) {
|
||||||
m_host->setReachable(false);
|
m_host->setReachable(false);
|
||||||
emit reachableChanged(false);
|
emit reachableChanged(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,6 +33,7 @@ private:
|
|||||||
Host *m_host;
|
Host *m_host;
|
||||||
QProcess *m_arpLookupProcess;
|
QProcess *m_arpLookupProcess;
|
||||||
QProcess *m_pingProcess;
|
QProcess *m_pingProcess;
|
||||||
|
int m_failedPings = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user