|
84 | 84 | _OPT_END = const(255)
|
85 | 85 |
|
86 | 86 | # Packet buffer
|
87 |
| -_BUFF_LENGTH = 318 |
| 87 | +_BUFF_LENGTH = 512 |
88 | 88 | _BUFF = bytearray(_BUFF_LENGTH)
|
89 | 89 |
|
90 | 90 |
|
@@ -303,7 +303,8 @@ def _receive_dhcp_response(self, timeout: float) -> int:
|
303 | 303 | buffer = bytearray(b"")
|
304 | 304 | bytes_read = 0
|
305 | 305 | debug_msg("+ Beginning to receive…", self._debug)
|
306 |
| - while bytes_read <= minimum_packet_length and time.monotonic() < timeout: |
| 306 | + timeout += time.monotonic() |
| 307 | + while bytes_read < minimum_packet_length and time.monotonic() < timeout: |
307 | 308 | if self._eth.socket_available(self._wiz_sock, _SNMR_UDP):
|
308 | 309 | x = self._eth.read_udp(self._wiz_sock, _BUFF_LENGTH - bytes_read)[1]
|
309 | 310 | buffer.extend(x)
|
@@ -612,12 +613,18 @@ def option_reader(pointer: int) -> Tuple[int, int, bytes]:
|
612 | 613 | :returns Tuple[int, int, bytes]: Pointer to next option,
|
613 | 614 | option type, and option data.
|
614 | 615 | """
|
| 616 | + # debug_msg("initial pointer = {}".format(pointer), self._debug) |
615 | 617 | option_type = _BUFF[pointer]
|
| 618 | + # debug_msg("option type = {}".format(option_type), self._debug) |
616 | 619 | pointer += 1
|
617 | 620 | data_length = _BUFF[pointer]
|
| 621 | + # debug_msg("data length = {}".format(data_length), self._debug) |
618 | 622 | pointer += 1
|
619 | 623 | data_end = pointer + data_length
|
| 624 | + # debug_msg("data end = {}".format(data_end), self._debug) |
620 | 625 | option_data = bytes(_BUFF[pointer:data_end])
|
| 626 | + # debug_msg(option_data, self._debug) |
| 627 | + # debug_msg("Final pointer = {}".format(pointer), self._debug) |
621 | 628 | return data_end, option_type, option_data
|
622 | 629 |
|
623 | 630 | debug_msg("Parsing DHCP message.", self._debug)
|
|
0 commit comments