tcp_enqueue_flags: no need to check pcb->snd_queuelen

We only allow SYN or FIN in this functions and FIN shall always come
through, so no need to check pcb->snd_queuelen
This commit is contained in:
goldsimon 2018-01-28 20:57:53 +01:00
parent d6cf8a3e38
commit 83ff2014ae

View File

@ -839,16 +839,7 @@ tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags)
LWIP_ASSERT("tcp_enqueue_flags: need either TCP_SYN or TCP_FIN in flags (programmer violates API)",
(flags & (TCP_SYN | TCP_FIN)) != 0);
/* check for configured max queuelen and possible overflow (FIN flag should always come through!) */
if (((pcb->snd_queuelen >= TCP_SND_QUEUELEN) || (pcb->snd_queuelen > TCP_SNDQUEUELEN_OVERFLOW)) &&
((flags & TCP_FIN) == 0)) {
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SEVERE, ("tcp_enqueue_flags: too long queue %"U16_F" (max %"U16_F")\n",
pcb->snd_queuelen, (u16_t)TCP_SND_QUEUELEN));
TCP_STATS_INC(tcp.memerr);
tcp_set_flags(pcb, TF_NAGLEMEMERR);
return ERR_MEM;
}
/* No need to check pcb->snd_queuelen if only SYN or FIN are allowed! */
if (flags & TCP_SYN) {
optflags = TF_SEG_OPTS_MSS;