Skip to content

Commit 8e8625a

Browse files
committed
better fix
1 parent 75f0194 commit 8e8625a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

adafruit_wiznet5k/adafruit_wiznet5k_dhcp.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def parse_dhcp_response(self, response_timeout):
225225
while packet_sz <= 0:
226226
packet_sz = self._sock.available()
227227
if (time.monotonic() - start_time) > response_timeout:
228-
return 255
228+
return (255, 0)
229229
time.sleep(0.05)
230230
# store packet in buffer
231231
_BUFF = self._sock.recv(packet_sz)[0]
@@ -288,11 +288,7 @@ def request_dhcp_lease(self):
288288
((time.monotonic() - start_time) / 1000))
289289
self._dhcp_state = STATE_DHCP_DISCOVER
290290
elif self._dhcp_state == STATE_DHCP_DISCOVER:
291-
resp = self.parse_dhcp_response(self._timeout)
292-
if resp == 255:
293-
print("Timeout waiting for DHCP response")
294-
continue
295-
msg_type, xid = resp
291+
msg_type, xid = self.parse_dhcp_response(self._timeout)
296292
if msg_type == DHCP_OFFER:
297293
# use the _transaction_id the offer returned,
298294
# rather than the current one

0 commit comments

Comments
 (0)