mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
usrsock/recv: adjust the close timing to avoid data discard
Change-Id: I7bf1cf06c3b73dc32ff38388926b7ffb979b832d Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
@@ -99,7 +99,7 @@ static uint16_t recvfrom_event(FAR struct net_driver_s *dev,
|
||||
pstate->valuelen_nontrunc = conn->resp.valuelen_nontrunc;
|
||||
}
|
||||
|
||||
if (pstate->reqstate.result >= 0 ||
|
||||
if (pstate->reqstate.result == 0 ||
|
||||
pstate->reqstate.result == -EAGAIN)
|
||||
{
|
||||
/* After reception of data, mark input not ready. Daemon will
|
||||
@@ -426,7 +426,14 @@ ssize_t usrsock_recvmsg(FAR struct socket *psock, FAR struct msghdr *msg,
|
||||
|
||||
outaddrlen = state.valuelen_nontrunc;
|
||||
|
||||
conn->flags |= USRSOCK_EVENT_RECVFROM_AVAIL;
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user