From 74ecb5261ea08791832fd305acea05146cd05a48 Mon Sep 17 00:00:00 2001 From: yangpeng Date: Wed, 6 Nov 2024 10:26:50 +0800 Subject: [PATCH] =?UTF-8?q?[components/net/at]=E4=BF=AE=E5=A4=8D=E5=A4=A7?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=8F=E4=BC=A0=E8=BE=93socket=E6=96=AD?= =?UTF-8?q?=E5=BC=80=E5=90=8E=E5=8F=AF=E8=83=BD=E4=B8=A2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/net/at/at_socket/at_socket.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/net/at/at_socket/at_socket.c b/components/net/at/at_socket/at_socket.c index 2973120205..4c5dee2b62 100644 --- a/components/net/at/at_socket/at_socket.c +++ b/components/net/at/at_socket/at_socket.c @@ -1065,13 +1065,6 @@ int at_recvfrom(int socket, void *mem, size_t len, int flags, struct sockaddr *f 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 */ rt_mutex_take(sock->recv_lock, RT_WAITING_FOREVER); 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; } + if (sock->state == AT_SOCKET_CLOSED) + { + /* socket passively closed, receive function return 0 */ + result = 0; + goto __exit; + } + if (flags & MSG_DONTWAIT) { rt_set_errno(EAGAIN);