fix(multi-sockets): Fix multi-clients connection abnormal

select() should not judge socket fd just SHUTDOWN state when other socket closed actively
those socket will be in unreadable or unwriteable

abnormal step before:[ESP8266 as the tcp server]
1. ESP8266 set up a listen port (system default: socket = 0)
2. Client 1 connect to ESP8266 OK (system default: socket = 1)
3. Client 1 send data OK
4. Client 2 connect to ESP8266 OK (system default: socket = 2)
5. Client 1 and Client 2 send data OK
6. Disconnect Client 2 actively, Client 1 send data OK
7. Client 2 reconnect to ESP8266 OK (system default: socket = 2)
8. Client 1 and Client 2 send data OK
9. Disconnect Client 1 actively, select() API will return -1
    if Client 2 send data at this time, tcp server will not work

internal: 7c50f410
This commit is contained in:
Espressif Systems
2018-01-08 10:30:45 +08:00
parent e929eef26e
commit 25de141e64
3 changed files with 3 additions and 2 deletions

View File

@ -13,7 +13,7 @@ gwen:
gitlab:
espconn: 3a998034
freertos: ac047746
lwip: ac047746
lwip: 94e6ac0e
driver: 7bee5263
mbedtls: 1ac9f1f4
ssl: eefb383a

Binary file not shown.

View File

@ -370,7 +370,8 @@ LOCAL int lwip_exit_mt_select(int s, int arg)
}
for (i = 0; i < s; i++) {
if (SOCK_MT_GET_SHUTDOWN(i) != SOCK_MT_SHUTDOWN_NONE) {
if ((FD_ISSET(i, read_set) || FD_ISSET(i, write_set)) \
&& SOCK_MT_GET_SHUTDOWN(i) != SOCK_MT_SHUTDOWN_NONE) {
return -1;
}
}