From: Tomas Hruby Date: Sun, 14 Oct 2012 20:18:12 +0000 (+0000) Subject: LWIP - fixed TCP panic when shutting down X-Git-Tag: v3.3.0~1067 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/NetBSD.png?a=commitdiff_plain;h=f6b5201f641d3c4af0478bcd4fb14aebd3448f8d;p=minix.git LWIP - fixed TCP panic when shutting down - listening sockets do not handle some callbacks --- diff --git a/servers/lwip/tcp.c b/servers/lwip/tcp.c index 077b964df..086484f0a 100644 --- a/servers/lwip/tcp.c +++ b/servers/lwip/tcp.c @@ -156,10 +156,12 @@ static void tcp_op_close(struct socket * sock, __unused message * m) int err; /* we are not able to handle any callback anymore */ - tcp_arg((struct tcp_pcb *)sock->pcb, NULL); - tcp_err((struct tcp_pcb *)sock->pcb, NULL); - tcp_sent((struct tcp_pcb *)sock->pcb, NULL); - tcp_recv((struct tcp_pcb *)sock->pcb, NULL); + if (((struct tcp_pcb *)sock->pcb)->state != LISTEN) { + tcp_arg((struct tcp_pcb *)sock->pcb, NULL); + tcp_err((struct tcp_pcb *)sock->pcb, NULL); + tcp_sent((struct tcp_pcb *)sock->pcb, NULL); + tcp_recv((struct tcp_pcb *)sock->pcb, NULL); + } err = tcp_close(sock->pcb); assert(err == ERR_OK);