Skip to content

Commit a51d927

Browse files
committed
[components/net/at]修复大数据量传输socket断开后可能丢数据的问题
1 parent fc765e2 commit a51d927

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

components/net/at/at_socket/at_socket.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,13 +1065,6 @@ int at_recvfrom(int socket, void *mem, size_t len, int flags, struct sockaddr *f
10651065

10661066
while (1)
10671067
{
1068-
if (sock->state == AT_SOCKET_CLOSED)
1069-
{
1070-
/* socket passively closed, receive function return 0 */
1071-
result = 0;
1072-
goto __exit;
1073-
}
1074-
10751068
/* receive packet list last transmission of remaining data */
10761069
rt_mutex_take(sock->recv_lock, RT_WAITING_FOREVER);
10771070
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
10861079
goto __exit;
10871080
}
10881081

1082+
if (sock->state == AT_SOCKET_CLOSED)
1083+
{
1084+
/* socket passively closed, receive function return 0 */
1085+
result = 0;
1086+
goto __exit;
1087+
}
1088+
10891089
if (flags & MSG_DONTWAIT)
10901090
{
10911091
rt_set_errno(EAGAIN);

0 commit comments

Comments
 (0)