Skip to content

Commit 9cfd92f

Browse files
authored
Merge pull request #153 from us3r64/fix/socket-httpserver-poll
Fix socket accept flow and timeout code
2 parents 2b0358e + 6a90f75 commit 9cfd92f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

adafruit_wiznet5k/adafruit_wiznet5k_socket.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import gc
2828
from sys import byteorder
29+
from errno import ETIMEDOUT
2930

3031
from micropython import const
3132
from adafruit_ticks import ticks_ms, ticks_diff
@@ -400,6 +401,7 @@ def accept(
400401
while self._status not in (
401402
wiznet5k.adafruit_wiznet5k.SNSR_SOCK_SYNRECV,
402403
wiznet5k.adafruit_wiznet5k.SNSR_SOCK_ESTABLISHED,
404+
wiznet5k.adafruit_wiznet5k.SNSR_SOCK_LISTEN,
403405
):
404406
if (
405407
self._timeout
@@ -778,7 +780,7 @@ class timeout(TimeoutError):
778780
the timeout has elapsed and we haven't received any data yet."""
779781

780782
def __init__(self, msg):
781-
super().__init__(msg)
783+
super().__init__(ETIMEDOUT, msg)
782784

783785

784786
# pylint: enable=unused-argument, redefined-builtin, invalid-name

0 commit comments

Comments
 (0)