[components/net/at]修复大数据量传输socket断开后可能丢数据的问题
This commit is contained in:
parent
5a47564988
commit
74ecb5261e
|
@ -1065,13 +1065,6 @@ int at_recvfrom(int socket, void *mem, size_t len, int flags, struct sockaddr *f
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (sock->state == AT_SOCKET_CLOSED)
|
|
||||||
{
|
|
||||||
/* socket passively closed, receive function return 0 */
|
|
||||||
result = 0;
|
|
||||||
goto __exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* receive packet list last transmission of remaining data */
|
/* receive packet list last transmission of remaining data */
|
||||||
rt_mutex_take(sock->recv_lock, RT_WAITING_FOREVER);
|
rt_mutex_take(sock->recv_lock, RT_WAITING_FOREVER);
|
||||||
recv_len = at_recvpkt_get(&(sock->recvpkt_list), (char *)mem, len);
|
recv_len = at_recvpkt_get(&(sock->recvpkt_list), (char *)mem, len);
|
||||||
|
@ -1086,6 +1079,13 @@ int at_recvfrom(int socket, void *mem, size_t len, int flags, struct sockaddr *f
|
||||||
goto __exit;
|
goto __exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sock->state == AT_SOCKET_CLOSED)
|
||||||
|
{
|
||||||
|
/* socket passively closed, receive function return 0 */
|
||||||
|
result = 0;
|
||||||
|
goto __exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (flags & MSG_DONTWAIT)
|
if (flags & MSG_DONTWAIT)
|
||||||
{
|
{
|
||||||
rt_set_errno(EAGAIN);
|
rt_set_errno(EAGAIN);
|
||||||
|
|
Loading…
Reference in New Issue