net/usrsock: Fix recv() couldn't peek data

Fix a bug that recv() couldn't peek receive data.
recv() would be failed by previous recv() call with MSG_PEEK.
This commit is contained in:
SPRESENSE 2020-07-22 17:51:47 +09:00 committed by Xiang Xiao
parent 4ea94c67b1
commit 8f39b20488

View File

@ -424,6 +424,15 @@ ssize_t usrsock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
*/
outaddrlen = state.valuelen_nontrunc;
/* If the MSG_PEEK flag is enabled, it will only peek
* from the buffer, so remark the input as ready.
*/
if (flags & MSG_PEEK)
{
conn->flags |= USRSOCK_EVENT_RECVFROM_AVAIL;
}
}
}