Skip to content

Commit

Permalink
Merge pull request #149 from pinkavaj/pi-fix-close-wait
Browse files Browse the repository at this point in the history
Handle SNSR_SOCK_CLOSE_WAIT during accept()
  • Loading branch information
FoamyGuy authored Apr 22, 2024
2 parents ccb0c36 + 7d4f429 commit 2b0358e
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 @@ -406,6 +406,9 @@ def accept(
and 0 < self._timeout < ticks_diff(ticks_ms(), stamp) / 1000
):
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 2b0358e

Please sign in to comment.