File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
connectivity/lwipstack/source Expand file tree Collapse file tree 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)
287287 /* Check if TCP FSM is in ESTABLISHED state.
288288 * Then give extra time for connection close handshaking until TIME_WAIT state.
289289 * 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)) {
292293 _event_flag.clear (TCP_CLOSED_FLAG);
293294 netconn_shutdown (s->conn , false , true );
294295 _event_flag.wait_any (TCP_CLOSED_FLAG, TCP_CLOSE_TIMEOUT);
You can’t perform that action at this time.
0 commit comments