From 7e5937ab3f33bf9faa88ec52a635c9adbb9f803f Mon Sep 17 00:00:00 2001 From: maksarsanjeev Date: Fri, 16 Oct 2026 02:24:12 +0300 Subject: [PATCH] Net core: a moment without an address is not a network change When Wi-Fi briefly lost its address (DHCP renew), the empty snapshot became the baseline and the same address coming back looked like a move, restarting the core for nothing. Empty snapshots are ignored now. Co-Authored-By: Claude Opus 5.5 --- NotchBuddy/Sources/App/NetPanel.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/NotchBuddy/Sources/App/NetPanel.swift b/NotchBuddy/Sources/App/NetPanel.swift index 78ac52d..5cd7464 100644 --- a/NotchBuddy/Sources/App/NetPanel.swift +++ b/NotchBuddy/Sources/App/NetPanel.swift @@ -346,8 +346,11 @@ final class NetCore: ObservableObject { try? await Task.sleep(for: .seconds(4)) guard !Task.isCancelled else { return } let now = Self.physicalAddresses() - let moved = lastAddresses != nil && now != lastAddresses && !now.isEmpty - lastAddresses = now + // A moment without an address (DHCP renew, Wi-Fi blip) is not another network: + // only a change between two real addresses counts, else the core would restart + // when the same address comes back. + let moved = !now.isEmpty && lastAddresses != nil && now != lastAddresses + if !now.isEmpty { lastAddresses = now } if moved { // Another network: the WireGuard tunnels (Amnezia, clients) are still bound to // the old address — a clean core restart re-binds them without leaking.