altcp: fix altcp_tcp_close for LISTEN pcb

See bug #55219

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
(cherry picked from commit 064d816ea1f526a2f9b4d48eb8b195d1f7e91068)
This commit is contained in:
Simon Goldschmidt 2020-02-03 22:13:07 +01:00
parent a32ea1e793
commit 4022a19cbc

View File

@ -161,21 +161,25 @@ static void
altcp_tcp_remove_callbacks(struct tcp_pcb *tpcb) altcp_tcp_remove_callbacks(struct tcp_pcb *tpcb)
{ {
tcp_arg(tpcb, NULL); tcp_arg(tpcb, NULL);
tcp_recv(tpcb, NULL); if (tpcb->state != LISTEN) {
tcp_sent(tpcb, NULL); tcp_recv(tpcb, NULL);
tcp_err(tpcb, NULL); tcp_sent(tpcb, NULL);
tcp_poll(tpcb, NULL, tpcb->pollinterval); tcp_err(tpcb, NULL);
tcp_poll(tpcb, NULL, tpcb->pollinterval);
}
} }
static void static void
altcp_tcp_setup_callbacks(struct altcp_pcb *conn, struct tcp_pcb *tpcb) altcp_tcp_setup_callbacks(struct altcp_pcb *conn, struct tcp_pcb *tpcb)
{ {
tcp_arg(tpcb, conn); tcp_arg(tpcb, conn);
tcp_recv(tpcb, altcp_tcp_recv); /* this might be called for LISTN when close fails... */
tcp_sent(tpcb, altcp_tcp_sent); if (tpcb->state != LISTEN) {
tcp_err(tpcb, altcp_tcp_err); tcp_recv(tpcb, altcp_tcp_recv);
/* tcp_poll is set when interval is set by application */ tcp_sent(tpcb, altcp_tcp_sent);
/* listen is set totally different :-) */ tcp_err(tpcb, altcp_tcp_err);
/* tcp_poll is set when interval is set by application */
}
} }
static void static void