From 83ff2014ae9c37a7fe581404e912eb9ada540e37 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sun, 28 Jan 2018 20:57:53 +0100 Subject: [PATCH] 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 --- src/core/tcp_out.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index 711408d9..df39c8d8 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -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;