mirror of
https://github.com/espressif/esp-lwip.git
synced 2026-08-30 05:40:08 +00:00
Fix select_waiting not being decremented for sockets closed while in lwip_select()
See bug #57445. Short version of the description there: lwip_select() failed to decrement 'select_waiting' of a socket since that code part failed on 'free_pending' sockets. However, the code does not have to check that as it has marked the socket to be in use itself earlier. Signed-off-by: Simon Goldschmidt <[email protected]>
This commit is contained in:
committed by
xueyunfei
parent
5b2072ebb8
commit
ffd1059c9a
+2
-5
@@ -612,9 +612,6 @@ free_socket_locked(struct lwip_sock *sock, int is_tcp, struct netconn **conn,
|
||||
|
||||
*lastdata = sock->lastdata;
|
||||
sock->lastdata.pbuf = NULL;
|
||||
#if ESP_LWIP
|
||||
sock->select_waiting = 0;
|
||||
#endif /* ESP_LWIP */
|
||||
*conn = sock->conn;
|
||||
sock->conn = NULL;
|
||||
return 1;
|
||||
@@ -2165,7 +2162,8 @@ lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
|
||||
(exceptset && FD_ISSET(i, exceptset))) {
|
||||
struct lwip_sock *sock;
|
||||
SYS_ARCH_PROTECT(lev);
|
||||
sock = tryget_socket_unconn_locked(i);
|
||||
sock = tryget_socket_unconn_nouse(i);
|
||||
LWIP_ASSERT("socket gone at the end of select", sock != NULL);
|
||||
if (sock != NULL) {
|
||||
/* for now, handle select_waiting==0... */
|
||||
LWIP_ASSERT("sock->select_waiting > 0", sock->select_waiting > 0);
|
||||
@@ -2173,7 +2171,6 @@ lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
|
||||
sock->select_waiting--;
|
||||
}
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
done_socket(sock);
|
||||
} else {
|
||||
SYS_ARCH_UNPROTECT(lev);
|
||||
/* Not a valid socket */
|
||||
|
||||
Reference in New Issue
Block a user