5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 15:20:30 +00:00

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