More resilient broadcast handling (fixes #1907)
My theory is that some error condition on the socket results in it blocking for writes, which maybe also blocks reads... This separates the two into separate services with their own socket, with restarts and retries as appropriates on write timeouts and read/write errors. It should be more robust, hopefully, but I have a hard time testing the actual error conditions...
This commit is contained in:
@@ -86,17 +86,10 @@ func (d *Discoverer) StartLocal(localPort int, localMCAddr string) {
|
||||
}
|
||||
|
||||
func (d *Discoverer) startLocalIPv4Broadcasts(localPort int) {
|
||||
bb, err := beacon.NewBroadcast(localPort)
|
||||
if err != nil {
|
||||
if debug {
|
||||
l.Debugln("discover: Start local v4:", err)
|
||||
}
|
||||
l.Infoln("Local discovery over IPv4 unavailable")
|
||||
return
|
||||
}
|
||||
|
||||
bb := beacon.NewBroadcast(localPort)
|
||||
d.beacons = append(d.beacons, bb)
|
||||
go d.recvAnnouncements(bb)
|
||||
bb.ServeBackground()
|
||||
}
|
||||
|
||||
func (d *Discoverer) startLocalIPv6Multicasts(localMCAddr string) {
|
||||
|
||||
Reference in New Issue
Block a user