5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-26 03:41:37 +00:00

Increase multicast interval at startup from 1s to 15s

This commit is contained in:
Neil Alexander 2019-09-20 10:08:41 +01:00
parent 6432eaa9f5
commit 1cd4b6e8dd
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -29,6 +29,7 @@ type Multicast struct {
listeners map[string]*yggdrasil.TcpListener
listenPort uint16
isOpen bool
interval time.Duration
announcer *time.Timer
platformhandler *time.Timer
}
@ -42,6 +43,7 @@ func (m *Multicast) Init(core *yggdrasil.Core, state *config.NodeState, log *log
current := m.config.GetCurrent()
m.listenPort = current.LinkLocalTCPPort
m.groupAddr = "[ff02::114]:9001"
m.interval = time.Second
return nil
}
@ -245,9 +247,12 @@ func (m *Multicast) announce() {
break
}
}
m.announcer = time.AfterFunc(time.Second*15, func() {
m.announcer = time.AfterFunc(m.interval, func() {
m.Act(m, m.announce)
})
if m.interval.Seconds() < 15 {
m.interval += time.Second
}
}
func (m *Multicast) listen() {