Closes #121. Moved all references to hardware sockets in the DHCP module to _handle_dhcp_message and _receive_dhcp_response. Added try… finally block to ensure that the hardware socket is always closed.
Made the socket number a local method attribute since it doesn't need to be stored.
Removed unused methods to initialise and release hardware sockets.
Refactored DHCP module to use higher level calls to the WIZNET5K instance.
Renamed several methods in WIZNET5K as they are private and no longer called from outside WIZNET5K.
Added _read_socket_reservations and _read_sndport methods to WIZNET5K to help dumping of socket state for troubleshooting.
Tested with a DHCP server and without a DHCP server to force a TimeoutError. Hardware socket closed in both cases.
Tests carried out with wiznet5k_simpletest.py on w5100s, w5500 and w6100 chips.
Closes #121. Moved all references to hardware sockets in the DHCP module to
_handle_dhcp_message
and_receive_dhcp_response
. Addedtry… finally
block to ensure that the hardware socket is always closed. Made the socket number a local method attribute since it doesn't need to be stored. Removed unused methods to initialise and release hardware sockets. Refactored DHCP module to use higher level calls to theWIZNET5K
instance. Renamed several methods inWIZNET5K
as they are private and no longer called from outsideWIZNET5K
. Added_read_socket_reservations
and_read_sndport
methods toWIZNET5K
to help dumping of socket state for troubleshooting. Tested with a DHCP server and without a DHCP server to force a TimeoutError. Hardware socket closed in both cases. Tests carried out withwiznet5k_simpletest.py
on w5100s, w5500 and w6100 chips.