Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ambrop72/badvpn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMygod <contact-git@mygod.be>2019-08-20 04:52:27 +0300
committerMygod <contact-git@mygod.be>2019-08-20 04:52:27 +0300
commit0f37b52fd42a8ef0f38fe1a69531695eea88f08e (patch)
treeafad8e327bf0fc6a9690d4acfd4aa0d8e73c4f74
parentd78b147995f7a4cf506fb8eaa43fb9e13cbb4576 (diff)
Cherry pick http://git.savannah.nongnu.org/cgit/lwip.git/tree/src/core/tcp_out.c?id=04b983b4f376697f04980b8d547fa4d03aa10600
-rw-r--r--lwip/src/core/tcp_out.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lwip/src/core/tcp_out.c b/lwip/src/core/tcp_out.c
index 58fdaac..5f7bc17 100644
--- a/lwip/src/core/tcp_out.c
+++ b/lwip/src/core/tcp_out.c
@@ -1875,12 +1875,18 @@ tcp_split_unsent_seg(struct tcp_pcb *pcb, u16_t split)
seg->flags |= TF_SEG_DATA_CHECKSUMMED;
#endif /* TCP_CHECKSUM_ON_COPY */
+ /* Remove this segment from the queue since trimming it may free pbufs */
+ pcb->snd_queuelen -= pbuf_clen(useg->p);
+
/* Trim the original pbuf into our split size. At this point our remainder segment must be setup
successfully because we are modifying the original segment */
pbuf_realloc(useg->p, useg->p->tot_len - remainder);
useg->len -= remainder;
TCPH_SET_FLAG(useg->tcphdr, split_flags);
+ /* Add back to the queue with new trimmed pbuf */
+ pcb->snd_queuelen += pbuf_clen(useg->p);
+
#if TCP_CHECKSUM_ON_COPY
/* The checksum on the split segment is now incorrect. We need to re-run it over the split */
useg->chksum = 0;
@@ -1904,7 +1910,7 @@ tcp_split_unsent_seg(struct tcp_pcb *pcb, u16_t split)
/* Update number of segments on the queues. Note that length now may
* exceed TCP_SND_QUEUELEN! We don't have to touch pcb->snd_buf
* because the total amount of data is constant when packet is split */
- pcb->snd_queuelen++;
+ pcb->snd_queuelen += pbuf_clen(seg->p);
/* Finally insert remainder into queue after split (which stays head) */
seg->next = useg->next;