File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -906,11 +906,28 @@ def socket_close(self, socket_num: int) -> None:
906
906
:param int socket_num: The socket to close.
907
907
"""
908
908
debug_msg ("*** Closing socket {}" .format (socket_num ), self ._debug )
909
+ timeout = time .monotonic () + 5.0
909
910
self .write_sncr (socket_num , _CMD_SOCK_CLOSE )
911
+ debug_msg (" Waiting for close command to process…" , self ._debug )
910
912
while self .read_sncr (socket_num ):
913
+ if time .monotonic () < timeout :
914
+ raise RuntimeError (
915
+ "Wiznet5k failed to complete command, status = {}." .format (
916
+ self .read_sncr (socket_num )
917
+ )
918
+ )
911
919
time .sleep (0.0001 )
920
+ debug_msg (" Waiting for socket to close…" , self ._debug )
921
+ timeout = time .monotonic () + 5.0
912
922
while self .read_snsr (socket_num ) != SNSR_SOCK_CLOSED :
923
+ if time .monotonic () > timeout :
924
+ raise RuntimeError (
925
+ "Wiznet5k failed to close socket, status = {}." .format (
926
+ self .read_snsr (socket_num )
927
+ )
928
+ )
913
929
time .sleep (0.0001 )
930
+ debug_msg (" Socket has closed." , self ._debug )
914
931
915
932
def socket_disconnect (self , socket_num : int ) -> None :
916
933
"""
You can’t perform that action at this time.
0 commit comments