mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-25 23:01:38 +00:00
close listener when a multicast interface is removed
This commit is contained in:
parent
169b8747d4
commit
c2d6e9e8f1
@ -136,6 +136,7 @@ func (m *Multicast) _stop() error {
|
|||||||
m.log.Infoln("Stopping multicast module")
|
m.log.Infoln("Stopping multicast module")
|
||||||
m.isOpen = false
|
m.isOpen = false
|
||||||
for name := range m.listeners {
|
for name := range m.listeners {
|
||||||
|
m.listeners[name].listener.Listener.Close()
|
||||||
close(m.listeners[name].stop)
|
close(m.listeners[name].stop)
|
||||||
delete(m.listeners, name)
|
delete(m.listeners, name)
|
||||||
}
|
}
|
||||||
@ -213,6 +214,7 @@ func (m *Multicast) _monitorInterfaceChanges() {
|
|||||||
for name, intf := range m.listeners {
|
for name, intf := range m.listeners {
|
||||||
if _, ok := m._interfaces[name]; !ok {
|
if _, ok := m._interfaces[name]; !ok {
|
||||||
// This is a disappeared interface. Stop the announcer.
|
// This is a disappeared interface. Stop the announcer.
|
||||||
|
intf.listener.Listener.Close()
|
||||||
close(intf.stop)
|
close(intf.stop)
|
||||||
delete(m.listeners, name)
|
delete(m.listeners, name)
|
||||||
m.log.Debugln("Stopped multicasting on", name)
|
m.log.Debugln("Stopped multicasting on", name)
|
||||||
|
Loading…
Reference in New Issue
Block a user