mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-23 22:56:00 +00:00
sockets.c: Fix a possible problem because any new socket can't be created during the "close" (which can be "long" since fix for bug #20021).
This commit is contained in:
parent
8d2c8065eb
commit
5d872b26a1
|
@ -282,16 +282,14 @@ lwip_close(int s)
|
||||||
|
|
||||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_close(%d)\n", s));
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_close(%d)\n", s));
|
||||||
|
|
||||||
/* We cannot allow multiple closes of the same socket. */
|
|
||||||
sys_sem_wait(socksem);
|
|
||||||
|
|
||||||
sock = get_socket(s);
|
sock = get_socket(s);
|
||||||
if (!sock) {
|
if (!sock) {
|
||||||
sys_sem_signal(socksem);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
netconn_delete(sock->conn);
|
netconn_delete(sock->conn);
|
||||||
|
|
||||||
|
sys_sem_wait(socksem);
|
||||||
if (sock->lastdata) {
|
if (sock->lastdata) {
|
||||||
netbuf_delete(sock->lastdata);
|
netbuf_delete(sock->lastdata);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user