extmod/modusocket: Fix polling of a new socket.

New sockets should return HUP and WR when polled, following modlwip.
This commit is contained in:
iabdalkader 2022-05-12 12:58:45 +02:00 committed by Damien George
parent 79f3b8731b
commit 7b4147dd0b
1 changed files with 2 additions and 1 deletions

View File

@ -451,7 +451,8 @@ mp_uint_t socket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *
}
if (self->nic == MP_OBJ_NULL) {
if (request == MP_STREAM_POLL) {
return MP_STREAM_POLL_NVAL;
// New sockets are writable and not connected.
return MP_STREAM_POLL_HUP | MP_STREAM_POLL_WR;
}
*errcode = MP_EINVAL;
return MP_STREAM_ERROR;