mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-23 18:15:24 +00:00
Clean up a bit
This commit is contained in:
parent
0c7cf65d27
commit
127b7e311c
@ -26,17 +26,16 @@ const (
|
|||||||
// automatically.
|
// automatically.
|
||||||
type Multicast struct {
|
type Multicast struct {
|
||||||
phony.Inbox
|
phony.Inbox
|
||||||
core *yggdrasil.Core
|
core *yggdrasil.Core
|
||||||
config *config.NodeState
|
config *config.NodeState
|
||||||
log *log.Logger
|
log *log.Logger
|
||||||
sock *ipv6.PacketConn
|
sock *ipv6.PacketConn
|
||||||
groupAddr *net.UDPAddr
|
groupAddr *net.UDPAddr
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type multicastInterface struct {
|
type multicastInterface struct {
|
||||||
@ -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)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user