mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-21 17:16:29 +08:00
Merge branch 'bugfix/fix_reenter_close' into 'master'
lfix reenter lwip_close See merge request sdk/ESP8266_RTOS_SDK!954
This commit is contained in:
@ -661,6 +661,9 @@ int lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optl
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (tryget_socket(s) == NULL)
|
||||
return -1;
|
||||
|
||||
if (optname == SO_ERROR) {
|
||||
int retval = 0;
|
||||
|
||||
@ -772,6 +775,19 @@ int lwip_shutdown(int s, int how)
|
||||
int lwip_close(int s)
|
||||
{
|
||||
int ret;
|
||||
SYS_ARCH_DECL_PROTECT(lev);
|
||||
|
||||
if (tryget_socket(s) == NULL)
|
||||
return -1;
|
||||
|
||||
SYS_ARCH_PROTECT(lev);
|
||||
if (_sock_is_opened(s)) {
|
||||
_sock_set_open(s, 0);
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
} else {
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if ESP_UDP
|
||||
struct lwip_sock *sock = get_socket(s);
|
||||
@ -779,8 +795,6 @@ int lwip_close(int s)
|
||||
udp_sync_close_netconn(sock->conn);
|
||||
#endif
|
||||
|
||||
_sock_set_open(s, 0);
|
||||
|
||||
lwip_sync_mt(s, SHUT_RDWR);
|
||||
|
||||
ret = lwip_close_esp(s);
|
||||
|
Reference in New Issue
Block a user