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:
fbernon 2007-07-04 21:13:25 +00:00
parent 8d2c8065eb
commit 5d872b26a1

View File

@ -282,16 +282,14 @@ lwip_close(int 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);
if (!sock) {
sys_sem_signal(socksem);
return -1;
}
netconn_delete(sock->conn);
sys_sem_wait(socksem);
if (sock->lastdata) {
netbuf_delete(sock->lastdata);
}