Ensure discover() returns devices and not None
There's a small race condition in the discover() method. If recv() returns before the socket timeout is reached, but we hit the top of the loop after the timeout is reached, we'll return None rather than the set of devices.
This commit is contained in:
parent
877a7b7460
commit
b30fc0d1c1
1 changed files with 1 additions and 0 deletions
|
@ -126,6 +126,7 @@ def discover(timeout=None, local_ip_address=None):
|
|||
mac = responsepacket[0x3a:0x40]
|
||||
dev = gendevice(devtype, host, mac)
|
||||
devices.append(dev)
|
||||
return devices
|
||||
|
||||
|
||||
class device:
|
||||
|
|
Loading…
Reference in a new issue