Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incorrect error handling in send/recv would raise an OSError with an incorrect (negative) code. It's likely that this bug was always happening in the Pico W implementation, which became the basis of the current shared implementation. Push handling of WANT_{READ,WRITE} down into mbedtls_raise_error and use it in recv_into and send. Tested by connecting to google.com:443, sending nothing, and trying to read a byte: ```py import socketpool, ssl, time, wifi socket = socketpool.SocketPool(wifi.radio) ctx = ssl.SSLContext() with ctx.wrap_socket(socket.socket()) as ss: ss.connect(("google.com", 443)) ss.settimeout(1) b = bytearray(1) try: t0 = time.monotonic() ss.recv_into(b) except Exception as ee: t1 = time.monotonic() exc = ee print(t1-t0) raise exc ``` As desired, an exception `OSError: [Errno 116] ETIMEDOUT` occurred and the time delta value was 1.0 seconds. (tested on pycamera) Closes: adafruit#8988
- Loading branch information