Clean up a bit

This commit is contained in:
Neil Alexander 2020-05-02 22:37:12 +01:00
parent 0c7cf65d27
commit 127b7e311c
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -34,8 +34,7 @@ type Multicast struct {
listeners map[string]*multicastInterface
listenPort uint16
isOpen bool
interfaceMonitor *time.Timer
announcer *time.Timer
monitor *time.Timer
platformhandler *time.Timer
}
@ -47,15 +46,9 @@ type multicastInterface struct {
zone string
timer *time.Timer
interval time.Duration
send chan<- beacon
stop chan interface{}
}
type beacon struct {
llAddr string
zone string
}
// Init prepares the multicast interface for use.
func (m *Multicast) Init(core *yggdrasil.Core, state *config.NodeState, log *log.Logger, options interface{}) (err error) {
m.core = core
@ -135,14 +128,10 @@ func (m *Multicast) Stop() error {
func (m *Multicast) _stop() error {
m.log.Infoln("Stopping multicast module")
m.isOpen = false
/*
if m.monitorInterfaceChanges != nil {
m.monitorInterfaceChanges.Stop()
for name := range m.listeners {
close(m.listeners[name].stop)
delete(m.listeners, name)
}
if m.sendBeacons != nil {
m.sendBeacons.Stop()
}
*/
if m.platformhandler != nil {
m.platformhandler.Stop()
}
@ -226,7 +215,7 @@ func (m *Multicast) monitorInterfaceChanges() {
}
}
// Queue the next check.
m.interfaceMonitor = time.AfterFunc(time.Second, func() {
m.monitor = time.AfterFunc(time.Second, func() {
m.Act(m, m.monitorInterfaceChanges)
})
}