diff --git a/mongoose.c b/mongoose.c index 7f7f099c9c65d4cb116ff655855fca69d03e978c..3015c29fac35453b873dcaed528384b1dbf83fae 100644 --- a/mongoose.c +++ b/mongoose.c @@ -14230,7 +14230,7 @@ static err_t mg_lwip_tcp_recv_cb(void *arg, struct tcp_pcb *tpcb, struct mg_connection *nc = (struct mg_connection *) arg; DBG(("%p %p %u %d", nc, tpcb, (p != NULL ? p->tot_len : 0), err)); if (p == NULL) { - if (nc != NULL) { + if (nc != NULL && !(nc->flags & MG_F_CLOSE_IMMEDIATELY)) { mg_lwip_post_signal(MG_SIG_CLOSE_CONN, nc); } else { /* Tombstoned connection, do nothing. */