From c161e4df094e3397e749bdb18b9a7e5f230f59f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Fri, 5 May 2023 08:49:31 +0200 Subject: [PATCH] NetworkDeviceDiscovery: perform reachability verification ping --- .../hardware/network/networkdevicediscoveryimpl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libnymea-core/hardware/network/networkdevicediscoveryimpl.cpp b/libnymea-core/hardware/network/networkdevicediscoveryimpl.cpp index c3379aee..b3cc0370 100644 --- a/libnymea-core/hardware/network/networkdevicediscoveryimpl.cpp +++ b/libnymea-core/hardware/network/networkdevicediscoveryimpl.cpp @@ -608,6 +608,13 @@ void NetworkDeviceDiscoveryImpl::evaluateMonitor(NetworkDeviceMonitorImpl *monit return; } + if (!requiresRefresh && monitor->reachable() && currentDateTime <= monitor->lastConnectionAttempt().addSecs(m_rediscoveryInterval)) { + // Note: in some cases only a failed ping is able to mark a device as offline if some ARP proxy is responding to our ARP requests. + // Ping all network devices in any case once in a while, even if we think it is reachable. + qCDebug(dcNetworkDeviceDiscovery()) << monitor << "performing verification ping."; + requiresRefresh = true; + } + if (!requiresRefresh) return;