mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 19:50:30 +01:00
esp32/modsocket: Handle poll of a closed socket.
This gets tests/extmod/uselect_poll_basic.py working on the esp32.
This commit is contained in:
@@ -676,6 +676,9 @@ STATIC mp_uint_t socket_stream_write(mp_obj_t self_in, const void *buf, mp_uint_
|
|||||||
STATIC mp_uint_t socket_stream_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
|
STATIC mp_uint_t socket_stream_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
|
||||||
socket_obj_t *socket = self_in;
|
socket_obj_t *socket = self_in;
|
||||||
if (request == MP_STREAM_POLL) {
|
if (request == MP_STREAM_POLL) {
|
||||||
|
if (socket->fd == -1) {
|
||||||
|
return MP_STREAM_POLL_NVAL;
|
||||||
|
}
|
||||||
|
|
||||||
fd_set rfds;
|
fd_set rfds;
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
|
|||||||
Reference in New Issue
Block a user