File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 27
27
import gc
28
28
import time
29
29
from sys import byteorder
30
+ from errno import ETIMEDOUT
30
31
31
32
from micropython import const
32
33
@@ -400,12 +401,16 @@ def accept(
400
401
while self ._status not in (
401
402
wiznet5k .adafruit_wiznet5k .SNSR_SOCK_SYNRECV ,
402
403
wiznet5k .adafruit_wiznet5k .SNSR_SOCK_ESTABLISHED ,
404
+ wiznet5k .adafruit_wiznet5k .SNSR_SOCK_LISTEN ,
403
405
):
404
406
if self ._timeout and 0 < self ._timeout < time .monotonic () - stamp :
405
407
raise TimeoutError ("Failed to accept connection." )
406
408
if self ._status == wiznet5k .adafruit_wiznet5k .SNSR_SOCK_CLOSED :
407
409
self .close ()
408
410
self .listen ()
411
+ if self ._status == wiznet5k .adafruit_wiznet5k .SNSR_SOCK_CLOSE_WAIT :
412
+ self ._disconnect ()
413
+ self .listen ()
409
414
410
415
_ , addr = _the_interface .socket_accept (self ._socknum )
411
416
current_socknum = self ._socknum
@@ -772,7 +777,7 @@ class timeout(TimeoutError):
772
777
the timeout has elapsed and we haven't received any data yet."""
773
778
774
779
def __init__ (self , msg ):
775
- super ().__init__ (msg )
780
+ super ().__init__ (ETIMEDOUT , msg )
776
781
777
782
778
783
# pylint: enable=unused-argument, redefined-builtin, invalid-name
You can’t perform that action at this time.
0 commit comments