From cfb329b0793e6fe5729b673a885753d4cc097904 Mon Sep 17 00:00:00 2001 From: Sergey Bobrenok Date: Thu, 1 Aug 2024 00:39:02 +0300 Subject: [PATCH] Close multicast listeners on stop On Android, if Yggdrasil is disabled, but multicast listeners are not closed, it's stuck in some kind of live-lock: Connected inbound: 202:14b7:a:b:c:d:e:f@[a::b:c:d:e%wlan0]:37351, source [f::e:d:c:b%wlan0]:41127 Disconnected inbound: 202:14b7:a:b:c:d:e:f@[a::b:c:d:e%wlan0]:37351, source [f::e:d:c:b%wlan0]:41127; error: ErrClosed ... And the only way to resolve this issue is to restart the entire process. --- src/multicast/multicast.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/multicast/multicast.go b/src/multicast/multicast.go index e74c0cacd..c83245339 100644 --- a/src/multicast/multicast.go +++ b/src/multicast/multicast.go @@ -142,6 +142,12 @@ func (m *Multicast) _stop() error { if m.sock != nil { m.sock.Close() } + for name, info := range m._listeners { + info.listener.Close() + m.log.Debugln("Stop multicasting on ", name) + } + clear(m._listeners) + return nil }