Skip to content

Commit fafe6e8

Browse files
author
BiffoBear
committed
Fixed bug where timeout was calculated as 2 x time.monotonic + n seconds.
1 parent 82277ca commit fafe6e8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

adafruit_wiznet5k/adafruit_wiznet5k_dhcp.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def _receive_dhcp_response(self, timeout: float) -> int:
293293
If the packet is too short, it is discarded and zero is returned. The
294294
maximum packet size is limited by the size of the global buffer.
295295
296-
:param float timeout: Seconds to wait for a process to complete.
296+
:param float timeout: time.monotonic at which attempt should timeout.
297297
298298
:returns int: The number of bytes stored in the global buffer.
299299
"""
@@ -303,7 +303,6 @@ def _receive_dhcp_response(self, timeout: float) -> int:
303303
buffer = bytearray(b"")
304304
bytes_read = 0
305305
debug_msg("+ Beginning to receive…", self._debug)
306-
timeout += time.monotonic()
307306
while bytes_read < minimum_packet_length and time.monotonic() < timeout:
308307
if self._eth.socket_available(self._wiz_sock, _SNMR_UDP):
309308
x = self._eth.read_udp(self._wiz_sock, _BUFF_LENGTH - bytes_read)[1]

0 commit comments

Comments
 (0)