diff options
author | Daniel Høyer Iversen <mail@dahoiv.net> | 2016-12-20T07·27+0100 |
---|---|---|
committer | Matthew Garrett <mjg59@coreos.com> | 2016-12-25T11·16+0000 |
commit | b30fc0d1c196320751d196d9b1d62843163b197d (patch) | |
tree | ffcb1173932be6c22128e31b2987937303b01660 /broadlink/__init__.py | |
parent | 877a7b7460f12c9dfa825e0548408c968de63494 (diff) |
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.
Diffstat (limited to 'broadlink/__init__.py')
-rw-r--r-- | broadlink/__init__.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/broadlink/__init__.py b/broadlink/__init__.py index 37a7fcbec26c..12d8b30d518f 100644 --- a/broadlink/__init__.py +++ b/broadlink/__init__.py @@ -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: |