From c00779c7d3959ddad37ab63923aad567afb176fb Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 29 Sep 2024 20:58:10 +0100 Subject: [PATCH] Multicast interface detection and shutdown tweaks May help with #1173. --- src/core/link.go | 5 ++++- src/multicast/multicast.go | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/link.go b/src/core/link.go index 2eb480d27..4a8df538f 100644 --- a/src/core/link.go +++ b/src/core/link.go @@ -422,7 +422,10 @@ func (l *links) listen(u *url.URL, sintf string) (*Listener, error) { li := &Listener{ listener: listener, ctx: ctx, - Cancel: cancel, + Cancel: func() { + cancel() + _ = listener.Close() + }, } var options linkOptions diff --git a/src/multicast/multicast.go b/src/multicast/multicast.go index 902d77292..32f5dcad8 100644 --- a/src/multicast/multicast.go +++ b/src/multicast/multicast.go @@ -190,6 +190,8 @@ func (m *Multicast) _getAllowedInterfaces() map[string]*interfaceInfo { switch { case iface.Flags&net.FlagUp == 0: continue // Ignore interfaces that are down + case iface.Flags&net.FlagRunning == 0: + continue // Ignore interfaces that are not running case iface.Flags&net.FlagMulticast == 0: continue // Ignore non-multicast interfaces case iface.Flags&net.FlagPointToPoint != 0: