mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
tcp_in: favour code block over #ifdef blocks for local variables only used in TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS configs
This commit is contained in:
parent
f48c71e17f
commit
6d2b181cc0
@ -1097,7 +1097,7 @@ tcp_free_acked_segments(struct tcp_pcb *pcb, struct tcp_seg *seg_list, const cha
|
|||||||
static void
|
static void
|
||||||
tcp_receive(struct tcp_pcb *pcb)
|
tcp_receive(struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
#if TCP_QUEUE_OOSEQ || TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS
|
#if TCP_QUEUE_OOSEQ
|
||||||
struct tcp_seg *next;
|
struct tcp_seg *next;
|
||||||
#endif
|
#endif
|
||||||
#if TCP_QUEUE_OOSEQ
|
#if TCP_QUEUE_OOSEQ
|
||||||
@ -1106,10 +1106,6 @@ tcp_receive(struct tcp_pcb *pcb)
|
|||||||
s16_t m;
|
s16_t m;
|
||||||
u32_t right_wnd_edge;
|
u32_t right_wnd_edge;
|
||||||
int found_dupack = 0;
|
int found_dupack = 0;
|
||||||
#if TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS
|
|
||||||
u32_t ooseq_blen;
|
|
||||||
u16_t ooseq_qlen;
|
|
||||||
#endif /* TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS */
|
|
||||||
|
|
||||||
LWIP_ASSERT("tcp_receive: wrong state", pcb->state >= ESTABLISHED);
|
LWIP_ASSERT("tcp_receive: wrong state", pcb->state >= ESTABLISHED);
|
||||||
|
|
||||||
@ -1782,33 +1778,35 @@ tcp_receive(struct tcp_pcb *pcb)
|
|||||||
#endif /* LWIP_TCP_SACK_OUT */
|
#endif /* LWIP_TCP_SACK_OUT */
|
||||||
}
|
}
|
||||||
#if TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS
|
#if TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS
|
||||||
/* Check that the data on ooseq doesn't exceed one of the limits
|
{
|
||||||
and throw away everything above that limit. */
|
/* Check that the data on ooseq doesn't exceed one of the limits
|
||||||
ooseq_blen = 0;
|
and throw away everything above that limit. */
|
||||||
ooseq_qlen = 0;
|
u32_t ooseq_blen = 0;
|
||||||
prev = NULL;
|
u16_t ooseq_qlen = 0;
|
||||||
for (next = pcb->ooseq; next != NULL; prev = next, next = next->next) {
|
prev = NULL;
|
||||||
struct pbuf *p = next->p;
|
for (next = pcb->ooseq; next != NULL; prev = next, next = next->next) {
|
||||||
ooseq_blen += p->tot_len;
|
struct pbuf *p = next->p;
|
||||||
ooseq_qlen += pbuf_clen(p);
|
ooseq_blen += p->tot_len;
|
||||||
if ((ooseq_blen > TCP_OOSEQ_MAX_BYTES) ||
|
ooseq_qlen += pbuf_clen(p);
|
||||||
(ooseq_qlen > TCP_OOSEQ_MAX_PBUFS)) {
|
if ((ooseq_blen > TCP_OOSEQ_MAX_BYTES) ||
|
||||||
|
(ooseq_qlen > TCP_OOSEQ_MAX_PBUFS)) {
|
||||||
#if LWIP_TCP_SACK_OUT
|
#if LWIP_TCP_SACK_OUT
|
||||||
if (pcb->flags & TF_SACK) {
|
if (pcb->flags & TF_SACK) {
|
||||||
/* Let's remove all SACKs from next's seqno up. */
|
/* Let's remove all SACKs from next's seqno up. */
|
||||||
tcp_remove_sacks_gt(pcb, next->tcphdr->seqno);
|
tcp_remove_sacks_gt(pcb, next->tcphdr->seqno);
|
||||||
}
|
}
|
||||||
#endif /* LWIP_TCP_SACK_OUT */
|
#endif /* LWIP_TCP_SACK_OUT */
|
||||||
/* too much ooseq data, dump this and everything after it */
|
/* too much ooseq data, dump this and everything after it */
|
||||||
tcp_segs_free(next);
|
tcp_segs_free(next);
|
||||||
if (prev == NULL) {
|
if (prev == NULL) {
|
||||||
/* first ooseq segment is too much, dump the whole queue */
|
/* first ooseq segment is too much, dump the whole queue */
|
||||||
pcb->ooseq = NULL;
|
pcb->ooseq = NULL;
|
||||||
} else {
|
} else {
|
||||||
/* just dump 'next' and everything after it */
|
/* just dump 'next' and everything after it */
|
||||||
prev->next = NULL;
|
prev->next = NULL;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS */
|
#endif /* TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS */
|
||||||
|
Loading…
Reference in New Issue
Block a user