From 1cd4b6e8ddc8d72b67bb6fadf3896f2246e57425 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 20 Sep 2019 10:08:41 +0100 Subject: [PATCH] Increase multicast interval at startup from 1s to 15s --- src/multicast/multicast.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/multicast/multicast.go b/src/multicast/multicast.go index 7f2f5915..cc7b9af5 100644 --- a/src/multicast/multicast.go +++ b/src/multicast/multicast.go @@ -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() {