Skip to content

Commit

Permalink
Handle SNSR_SOCK_CLOSE_WAIT during accept()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pinkavaj committed Mar 3, 2024
1 parent a0e9562 commit 7d4f429
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions adafruit_wiznet5k/adafruit_wiznet5k_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ def accept(
):
if self._timeout and 0 < self._timeout < time.monotonic() - stamp:
raise TimeoutError("Failed to accept connection.")
if self._status == wiznet5k.adafruit_wiznet5k.SNSR_SOCK_CLOSE_WAIT:
self._disconnect()
self.listen()
if self._status == wiznet5k.adafruit_wiznet5k.SNSR_SOCK_CLOSED:
self.close()
self.listen()
Expand Down

0 comments on commit 7d4f429

Please sign in to comment.