Skip to content

Commit d638117

Browse files
committed
Properly close socked which is already in disconnection state
The socker might be already disconnecting due to FIN from the other side, in this case still close the socket to finish the operation but do not reset the ISR, because we will not get another SNIR_DISCON and would end up in inifite loop.
1 parent a0e9562 commit d638117

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adafruit_wiznet5k/adafruit_wiznet5k_socket.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def __exit__(self, exc_type, exc_val, exc_tb) -> None:
247247
_the_interface.release_socket(self._socknum)
248248
if self._sock_type == SOCK_STREAM:
249249
_the_interface.write_snir(
250-
self._socknum, 0xFF
250+
self._socknum, 0xFF & (~wiznet5k.adafruit_wiznet5k.SNIR_DISCON)
251251
) # Reset socket interrupt register.
252252
_the_interface.socket_disconnect(self._socknum)
253253
mask = (

0 commit comments

Comments
 (0)