fixed bug #52403: netconn: FIN may be sent instead of RST when TCP netconn is closed with pending data in recv_mbox

This commit is contained in:
goldsimon 2017-11-15 21:12:15 +01:00
parent bd2e820829
commit 245a6835f3

View File

@ -806,9 +806,6 @@ static void
netconn_drain(struct netconn *conn) netconn_drain(struct netconn *conn)
{ {
void *mem; void *mem;
#if LWIP_TCP
struct pbuf *p;
#endif /* LWIP_TCP */
/* This runs in tcpip_thread, so we don't need to lock against rx packets */ /* This runs in tcpip_thread, so we don't need to lock against rx packets */
@ -819,12 +816,7 @@ netconn_drain(struct netconn *conn)
if (NETCONNTYPE_GROUP(conn->type) == NETCONN_TCP) { if (NETCONNTYPE_GROUP(conn->type) == NETCONN_TCP) {
err_t err; err_t err;
if (!lwip_netconn_is_err_msg(mem, &err)) { if (!lwip_netconn_is_err_msg(mem, &err)) {
p = (struct pbuf *)mem; pbuf_free((struct pbuf *)mem);
/* pcb might be set to NULL already by err_tcp() */
if (conn->pcb.tcp != NULL) {
tcp_recved(conn->pcb.tcp, p->tot_len);
}
pbuf_free(p);
} }
} else } else
#endif /* LWIP_TCP */ #endif /* LWIP_TCP */