File tree 1 file changed +3
-2
lines changed
connectivity/lwipstack/source
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -287,8 +287,9 @@ nsapi_error_t LWIP::socket_close(nsapi_socket_t handle)
287
287
/* Check if TCP FSM is in ESTABLISHED state.
288
288
* Then give extra time for connection close handshaking until TIME_WAIT state.
289
289
* The purpose is to prevent eth/wifi driver stop and FIN ACK corrupt.
290
- * This may happend if network interface disconnect follows immediately after socket_close.*/
291
- if (NETCONNTYPE_GROUP (s->conn ->type ) == NETCONN_TCP && s->conn ->pcb .tcp ->state == ESTABLISHED) {
290
+ * This may happend if network interface disconnect follows immediately after socket_close.
291
+ * In case of a TCP RESET flag, the pcb structure is already deleted, therefore check for nullpointer.*/
292
+ if (NETCONNTYPE_GROUP (s->conn ->type ) == NETCONN_TCP && (nullptr == s->conn ->pcb .tcp || s->conn ->pcb .tcp ->state == ESTABLISHED)) {
292
293
_event_flag.clear (TCP_CLOSED_FLAG);
293
294
netconn_shutdown (s->conn , false , true );
294
295
_event_flag.wait_any (TCP_CLOSED_FLAG, TCP_CLOSE_TIMEOUT);
You can’t perform that action at this time.
0 commit comments