Allow multicast to be shut down more sanely

This commit is contained in:
Neil Alexander 2019-09-18 15:31:43 +01:00
parent 00a972b74e
commit 366fe7e772
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 113 additions and 118 deletions

View file

@ -32,21 +32,14 @@ import (
var awdlGoroutineStarted bool
func (m *Multicast) multicastStarted() {
if awdlGoroutineStarted {
return
}
awdlGoroutineStarted = true
for {
C.StopAWDLBrowsing()
for intf := range m.Interfaces() {
if intf == "awdl0" {
m.log.Infoln("Multicast discovery is using AWDL discovery")
C.StartAWDLBrowsing()
break
}
C.StopAWDLBrowsing()
for intf := range m.Interfaces() {
if intf == "awdl0" {
C.StartAWDLBrowsing()
break
}
time.Sleep(time.Minute)
}
m.platformhandler = time.AfterFunc(time.Minute, m.multicastStarted)
}
func (m *Multicast) multicastReuse(network string, address string, c syscall.RawConn) error {