mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
Merge pull request #1730 from calmh/bug-1721
Don't hang when attempting multicast discovery on non-multicast interfaces
This commit is contained in:
commit
a5e11c7489
@ -100,7 +100,7 @@ func Discover(timeout time.Duration) []IGD {
|
||||
return results
|
||||
}
|
||||
|
||||
resultChan := make(chan IGD, 16)
|
||||
resultChan := make(chan IGD)
|
||||
|
||||
// Aggregator
|
||||
go func() {
|
||||
@ -129,6 +129,13 @@ func Discover(timeout time.Duration) []IGD {
|
||||
|
||||
wg := sync.NewWaitGroup()
|
||||
for _, intf := range interfaces {
|
||||
if intf.Flags&net.FlagUp == 0 {
|
||||
continue
|
||||
}
|
||||
if intf.Flags&net.FlagMulticast == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, deviceType := range []string{"urn:schemas-upnp-org:device:InternetGatewayDevice:1", "urn:schemas-upnp-org:device:InternetGatewayDevice:2"} {
|
||||
wg.Add(1)
|
||||
go func(intf net.Interface, deviceType string) {
|
||||
@ -195,7 +202,7 @@ Mx: %d
|
||||
|
||||
// Listen for responses until a timeout is reached
|
||||
for {
|
||||
resp := make([]byte, 1500)
|
||||
resp := make([]byte, 65536)
|
||||
n, _, err := socket.ReadFrom(resp)
|
||||
if err != nil {
|
||||
if e, ok := err.(net.Error); !ok || !e.Timeout() {
|
||||
|
Loading…
Reference in New Issue
Block a user