Skip to content

Commit 25de141

Browse files
committed
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
1 parent e929eef commit 25de141

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ gwen:
1313
gitlab:
1414
espconn: 3a998034
1515
freertos: ac047746
16-
lwip: ac047746
16+
lwip: 94e6ac0e
1717
driver: 7bee5263
1818
mbedtls: 1ac9f1f4
1919
ssl: eefb383a

lib/liblwip.a

36 Bytes
Binary file not shown.

third_party/lwip/api/multi-threads/sockets_mt.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,8 @@ LOCAL int lwip_exit_mt_select(int s, int arg)
370370
}
371371

372372
for (i = 0; i < s; i++) {
373-
if (SOCK_MT_GET_SHUTDOWN(i) != SOCK_MT_SHUTDOWN_NONE) {
373+
if ((FD_ISSET(i, read_set) || FD_ISSET(i, write_set)) \
374+
&& SOCK_MT_GET_SHUTDOWN(i) != SOCK_MT_SHUTDOWN_NONE) {
374375
return -1;
375376
}
376377
}

0 commit comments

Comments
 (0)