tcp_output: slightly move the jump target 'output_done': when nothing is to send, pcb->unsent cannot be NULL; add a

This commit is contained in:
goldsimon 2017-06-29 08:43:59 +02:00
parent 229c9edad2
commit 48e55b1e5d

View File

@ -1089,6 +1089,12 @@ tcp_output(struct tcp_pcb *pcb)
lwip_ntohl(seg->tcphdr->seqno), pcb->lastack)); lwip_ntohl(seg->tcphdr->seqno), pcb->lastack));
} }
#endif /* TCP_CWND_DEBUG */ #endif /* TCP_CWND_DEBUG */
if (seg == NULL) {
/* nothing to send: shortcut out of here */
goto output_done;
}
/* Check if we need to start the persistent timer when the next unsent segment /* Check if we need to start the persistent timer when the next unsent segment
* does not fit within the remaining send window and RTO timer is not running (we * does not fit within the remaining send window and RTO timer is not running (we
* have no in-flight data). A traditional approach would fill the remaining window * have no in-flight data). A traditional approach would fill the remaining window
@ -1187,7 +1193,6 @@ tcp_output(struct tcp_pcb *pcb)
} }
seg = pcb->unsent; seg = pcb->unsent;
} }
output_done:
#if TCP_OVERSIZE #if TCP_OVERSIZE
if (pcb->unsent == NULL) { if (pcb->unsent == NULL) {
/* last unsent has been removed, reset unsent_oversize */ /* last unsent has been removed, reset unsent_oversize */
@ -1195,6 +1200,7 @@ output_done:
} }
#endif /* TCP_OVERSIZE */ #endif /* TCP_OVERSIZE */
output_done:
pcb->flags &= ~TF_NAGLEMEMERR; pcb->flags &= ~TF_NAGLEMEMERR;
return ERR_OK; return ERR_OK;
} }