Commit 7c7bd31d authored by Alexey Kholupko's avatar Alexey Kholupko
Browse files

mDNS discovery starts announcing right away: does not wait for first interval to elapse.

Closes #256
parent c9eddef0
......@@ -118,8 +118,7 @@ func (m *mdnsService) pollForEntries(ctx context.Context) {
ticker := time.NewTicker(m.interval)
for {
select {
case <-ticker.C:
//execute mdns query right away at method call and then with every tick
entriesCh := make(chan *mdns.ServiceEntry, 16)
go func() {
for entry := range entriesCh {
......@@ -141,6 +140,10 @@ func (m *mdnsService) pollForEntries(ctx context.Context) {
}
close(entriesCh)
log.Debug("mdns query complete")
select {
case <-ticker.C:
continue
case <-ctx.Done():
log.Debug("mdns service halting")
return
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment