From dd245c63d7e2660de173b81e3764037be0ab5cea Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sun, 25 Mar 2012 17:19:46 +0200 Subject: [PATCH] tcp_abort/tcp_abandon: don't send RST if pcb->state is CLOSED --- src/core/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/tcp.c b/src/core/tcp.c index 3bcd41a3..05e7c7d8 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -375,6 +375,7 @@ tcp_abandon(struct tcp_pcb *pcb, int reset) tcp_pcb_remove(&tcp_tw_pcbs, pcb); memp_free(MEMP_TCP_PCB, pcb); } else { + int send_rst = reset && (pcb->state != CLOSED); seqno = pcb->snd_nxt; ackno = pcb->rcv_nxt; #if LWIP_CALLBACK_API @@ -393,7 +394,7 @@ tcp_abandon(struct tcp_pcb *pcb, int reset) tcp_segs_free(pcb->ooseq); } #endif /* TCP_QUEUE_OOSEQ */ - if (reset) { + if (send_rst) { LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_abandon: sending RST\n")); tcp_rst(seqno, ackno, &pcb->local_ip, &pcb->remote_ip, pcb->local_port, pcb->remote_port, PCB_ISIPV6(pcb)); }