mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-31 19:48:41 -04:00
Status() read the run loop's label outside any synchronization and then stored it, so a login or extend completing in that window was undone by the stale observation, stranding the UI on "login required" over a healthy session. Guard the latch with a mutex and a generation counter, and route both clears through the same helper, so a clear that lands mid-observation wins. The watch goroutines kept delivering to removed and replaced listeners: both subscriptions are buffered (one pending tick, ten pending events), and unsubscribing only stops new items while the loops drain what is already queued. On Android those callbacks cross into Java, so a delivery after teardown can reach a listener whose collaborators are gone. Give each registration a done signal, close it before unsubscribing, and check it immediately before every callback.