usrsock_server:fix incomplete received data error

if number of bytes available for reading more than zero,set USRSOCK_EVENT_RECVFROM_AVAIL flag into the event

Signed-off-by: wangchen <wangchen41@xiaomi.com>
This commit is contained in:
wangchen 2023-06-21 09:29:37 +08:00 committed by Petro Karashchenko
parent 9b8eedd218
commit dd0f967798

View File

@ -578,7 +578,6 @@ static int usrsock_rpmsg_recvfrom_handler(FAR struct rpmsg_endpoint *ept,
false); false);
if (!iov[i].iov_base) if (!iov[i].iov_base)
{ {
events |= USRSOCK_EVENT_RECVFROM_AVAIL;
break; break;
} }
@ -607,12 +606,16 @@ static int usrsock_rpmsg_recvfrom_handler(FAR struct rpmsg_endpoint *ept,
else else
{ {
iov[i].iov_len = 0; iov[i].iov_len = 0;
events |= USRSOCK_EVENT_RECVFROM_AVAIL;
break; break;
} }
i++; i++;
} }
if (usrsock_rpmsg_available(&priv->socks[req->usockid], FIONREAD))
{
events |= USRSOCK_EVENT_RECVFROM_AVAIL;
}
} }
} }