8000 esp32/modsocket: Handle poll of a closed socket. · micropython/micropython@bf4fb16 · GitHub
[go: up one dir, main page]

Skip to content

Commit bf4fb16

Browse files
committed
esp32/modsocket: Handle poll of a closed socket.
This gets tests/extmod/uselect_poll_basic.py working on the esp32.
1 parent fbfea3b commit bf4fb16

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ports/esp32/modsocket.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,9 @@ STATIC mp_uint_t socket_stream_write(mp_obj_t self_in, const void *buf, mp_uint_
676676
STATIC mp_uint_t socket_stream_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
677677
socket_obj_t *socket = self_in;
678678
if (request == MP_STREAM_POLL) {
679+
if (socket->fd == -1) {
680+
return MP_STREAM_POLL_NVAL;
681+
}
679682

680683
fd_set rfds;
681684
FD_ZERO(&rfds);

0 commit comments

Comments
 (0)
0