From 49e8e28cf6bef4bacbcd30dba4cede94b5e91be0 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Wed, 21 Apr 2010 19:55:14 +0000 Subject: [PATCH] Check that tcp_abort/tcp_abandon isn't called for listen-pcbs --- src/core/tcp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/tcp.c b/src/core/tcp.c index 4a8c36d8..67fbfee4 100644 --- a/src/core/tcp.c +++ b/src/core/tcp.c @@ -317,7 +317,9 @@ tcp_abandon(struct tcp_pcb *pcb, int reset) #endif /* LWIP_CALLBACK_API */ void *errf_arg; - + /* pcb->state LISTEN not allowed here */ + LWIP_ASSERT("don't call tcp_abort/tcp_abandon for listen-pcbs", + pcb->state != LISTEN); /* Figure out on which TCP PCB list we are, and remove us. If we are in an active state, call the receive function associated with the PCB with a NULL argument, and send an RST to the remote end. */ @@ -325,7 +327,6 @@ tcp_abandon(struct tcp_pcb *pcb, int reset) tcp_pcb_remove(&tcp_tw_pcbs, pcb); memp_free(MEMP_TCP_PCB, pcb); } else { - /* @todo: pcb->state, LISTEN not allowed */ seqno = pcb->snd_nxt; ackno = pcb->rcv_nxt; ip_addr_copy(local_ip, pcb->local_ip);