mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
lwip: fix nonblocking tcp close issue
Fix assert issue causes by closing nonblocking tcp socket.
This commit is contained in:
@@ -266,11 +266,11 @@ do{\
|
|||||||
}\
|
}\
|
||||||
}while(0)
|
}while(0)
|
||||||
|
|
||||||
#define LWIP_SET_CLOSE_FLAG() \
|
#define LWIP_SET_CLOSE_FLAG(_flag) \
|
||||||
do{\
|
do{\
|
||||||
LWIP_SOCK_LOCK(__sock);\
|
LWIP_SOCK_LOCK(__sock);\
|
||||||
LWIP_DEBUGF(ESP_THREAD_SAFE_DEBUG, ("mark sock closing\n"));\
|
LWIP_DEBUGF(ESP_THREAD_SAFE_DEBUG, ("mark sock closing\n"));\
|
||||||
__sock->state = LWIP_SOCK_CLOSING;\
|
__sock->state = (_flag);\
|
||||||
LWIP_SOCK_UNLOCK(__sock);\
|
LWIP_SOCK_UNLOCK(__sock);\
|
||||||
}while(0)
|
}while(0)
|
||||||
|
|
||||||
@@ -3312,8 +3312,11 @@ int
|
|||||||
lwip_close_r(int s)
|
lwip_close_r(int s)
|
||||||
{
|
{
|
||||||
LWIP_API_LOCK();
|
LWIP_API_LOCK();
|
||||||
LWIP_SET_CLOSE_FLAG();
|
LWIP_SET_CLOSE_FLAG(LWIP_SOCK_CLOSING);
|
||||||
__ret = lwip_close(s);
|
__ret = lwip_close(s);
|
||||||
|
if (EWOULDBLOCK == __sock->err) {
|
||||||
|
LWIP_SET_CLOSE_FLAG(LWIP_SOCK_OPEN);
|
||||||
|
}
|
||||||
LWIP_API_UNLOCK();
|
LWIP_API_UNLOCK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user