Skip to content

Commit 7d4f429

Browse files
committed
Handle SNSR_SOCK_CLOSE_WAIT during accept()
If we receive SYN, ACK and the we get FIX from the other side really fast, the connection state can go straight to the closing phase. If that happends lets just finis the close and continue listening.
1 parent a0e9562 commit 7d4f429

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

adafruit_wiznet5k/adafruit_wiznet5k_socket.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ def accept(
402402
):
403403
if self._timeout and 0 < self._timeout < time.monotonic() - stamp:
404404
raise TimeoutError("Failed to accept connection.")
405+
if self._status == wiznet5k.adafruit_wiznet5k.SNSR_SOCK_CLOSE_WAIT:
406+
self._disconnect()
407+
self.listen()
405408
if self._status == wiznet5k.adafruit_wiznet5k.SNSR_SOCK_CLOSED:
406409
self.close()
407410
self.listen()

0 commit comments

Comments
 (0)