lwip: optimize TCP close

Optimize TCP close:
1. Not remove TCP pcb when IP address is changed since the lwip netconn still need the pcb
2. If the TCP connection is in TCP_FIN_WAIT_1 for too long time, remove it
This commit is contained in:
Liu Zhi Fu
2017-07-19 09:15:11 +08:00
parent 843159b0d7
commit 4ad1f2b272
2 changed files with 17 additions and 31 deletions

View File

@@ -152,6 +152,7 @@ tcp_send_fin(struct tcp_pcb *pcb)
return ERR_OK;
}
}
/* no data, no length, flags, copy=1, no optdata */
return tcp_enqueue_flags(pcb, TCP_FIN);
}
@@ -1067,7 +1068,7 @@ tcp_output(struct tcp_pcb *pcb)
seg->oversize_left = 0;
#endif /* TCP_OVERSIZE_DBGCHECK */
err = tcp_output_segment(seg, pcb);
if (err != ERR_OK) {
if ((err != ERR_OK) && (err != ERR_RTE)) {
/* segment could not be sent, for whatever reason */
pcb->flags |= TF_NAGLEMEMERR;
return err;