fix: mDNS lookup
This commit is contained in:
parent
95eedc417b
commit
a4e2d54457
@ -124,13 +124,6 @@ func (f *FreeboxAPIVersion) newFreeboxAPIVersionMDNS(*FreeboxHttpClient) error {
|
||||
|
||||
// mDNS lookup
|
||||
go func() {
|
||||
defer close(entries)
|
||||
if err := mdns.Lookup(mdnsService, entries); err != nil {
|
||||
log.Error.Println("mDNS lookup failed:", err)
|
||||
}
|
||||
log.Debug.Println("End of mDNS lookup")
|
||||
}()
|
||||
|
||||
for entry := range entries {
|
||||
deviceName := entry.Name
|
||||
idx := strings.Index(deviceName, ".")
|
||||
@ -166,12 +159,16 @@ func (f *FreeboxAPIVersion) newFreeboxAPIVersionMDNS(*FreeboxHttpClient) error {
|
||||
default:
|
||||
}
|
||||
}
|
||||
if f.IsValid() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return errors.New("MDNS timeout")
|
||||
if err := mdns.Lookup(mdnsService, entries); err != nil {
|
||||
log.Error.Println("mDNS lookup failed:", err)
|
||||
return err
|
||||
}
|
||||
log.Debug.Println("End of mDNS lookup")
|
||||
close(entries)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *FreeboxAPIVersion) setQueryApiVersion(forceApiVersion int) error {
|
||||
|
Loading…
Reference in New Issue
Block a user