Skip to content

Commit e648982

Browse files
committed
Return response immediately instead of only when the socket times out
1 parent aa1cafd commit e648982

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

orvibo/s20.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ def _udp_transact(self, payload, handler, *args,
217217
# From the right device?
218218
if addr[0] == self.host:
219219
retval = handler(data, *args)
220+
# Return as soon as a response is received
221+
if retval:
222+
return retval
220223
except socket.timeout:
221224
break
222-
if retval:
223-
break
224-
return retval
225225

226226
def _turn_on(self):
227227
""" Turn on the device. """

0 commit comments

Comments
 (0)