CircuitPython version
Adafruit CircuitPython 8.2.0-49-g55c82f45d-dirty on 2023-08-01; DFRobot Beetle ESP32-C3 with ESP32-C3FN4
Code/REPL
#### a couple of reproducible examples
import wifi
import socketpool
wifi.radio.connect("mySSID", "myPASS")
pool = socketpool.SocketPool(wifi.radio)
sock = pool.socket(pool.AF_INET, pool.SOCK_STREAM)
sock.bind((str(wifi.radio.ipv4_address), 9876))
sock.listen(10)
sock.close()
# Blocks rather than raising EBADF
sock.accept()
# Note: In non-blocking mode, raises EAGAIN rather
# than EBADF
###################
sock = pool.socket(pool.AF_INET, pool.SOCK_DGRAM)
sock.bind((str(wifi.radio.ipv4_address), 9876))
sock.close()
# Blocks rather than raising EBADF
sock.recvfrom_into(bytearray(10))
# Note: In non-blocking mode, raises EAGAIN rather
# than EBADF
Behavior
Code blocks (or raises EAGAIN in non-blocking mode)
Description
No response
Additional information
It seems like the code in the espressif binding for socketpool (an example) is missing checks in some places for the actual errno set by lwip.
In certain cases it seems partially masked by checks in shared-binding (an example) but would it be best to raise the actual errno based exception directly from the port, so any issues beyond EBADF can be detected appropriately?
/cc @anecdata @superhac
CircuitPython version
Code/REPL
Behavior
Code blocks (or raises EAGAIN in non-blocking mode)
Description
No response
Additional information
It seems like the code in the espressif binding for socketpool (an example) is missing checks in some places for the actual
errnoset by lwip.In certain cases it seems partially masked by checks in shared-binding (an example) but would it be best to raise the actual
errnobased exception directly from the port, so any issues beyond EBADF can be detected appropriately?/cc @anecdata @superhac