1
0
mirror of https://github.com/mjg59/python-broadlink.git synced 2024-11-22 07:00:12 +01:00

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:
Daniel Høyer Iversen 2016-12-20 08:27:12 +01:00 committed by Matthew Garrett
parent 877a7b7460
commit b30fc0d1c1

View File

@ -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: