Fix some rare IOServiceGetMatchingServices failure on MacOSX
We had reports of users always getting: IOServiceGetMatchingServices failed, data changed while iterating The issue seems related to the function getMatchingServices that returns an always-invalid iterator even if there are no actual services. This is a workaround for this issue.
This commit is contained in:
@@ -97,8 +97,8 @@ func getAllServices(serviceType string) ([]io_object_t, error) {
|
|||||||
services = append(services, service)
|
services = append(services, service)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// If iterator is still valid return the result
|
// If the list of services is empty or the iterator is still valid return the result
|
||||||
if i.IsValid() {
|
if len(services) == 0 || i.IsValid() {
|
||||||
return services, nil
|
return services, nil
|
||||||
}
|
}
|
||||||
// Otherwise empty the result and retry
|
// Otherwise empty the result and retry
|
||||||
|
|||||||
Reference in New Issue
Block a user