Skip to content

Commit

Permalink
Update tcp_out.c
Browse files Browse the repository at this point in the history
  • Loading branch information
yukozh committed Sep 25, 2020
1 parent 91c040e commit 712a978
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions lwip/src/core/tcp_out.c
Original file line number Diff line number Diff line change
Expand Up @@ -1007,21 +1007,23 @@ tcp_output(struct tcp_pcb *pcb)
if (useg != NULL) {
for (; useg->next != NULL; useg = useg->next);
}
u32_t seqno = seg->tcphdr->seqno;
u32_t useqno = useg->tcphdr->seqno;
if (TCP_SEQ_LT(ntohl(seqno), ntohl(useqno))) {
/* add segment to before tail of unacked list, keeping the list sorted */
struct tcp_seg **cur_seg = &(pcb->unacked);
while (*cur_seg &&
TCP_SEQ_LT(ntohl((*cur_seg)->tcphdr->seqno), ntohl(seg->tcphdr->seqno))) {
cur_seg = &((*cur_seg)->next );
if (useg != NULL) {
u32_t seqno = seg->tcphdr->seqno;
u32_t useqno = useg->tcphdr->seqno;
if (TCP_SEQ_LT(ntohl(seqno), ntohl(useqno))) {
/* add segment to before tail of unacked list, keeping the list sorted */
struct tcp_seg **cur_seg = &(pcb->unacked);
while (*cur_seg &&
TCP_SEQ_LT(ntohl((*cur_seg)->tcphdr->seqno), ntohl(seg->tcphdr->seqno))) {
cur_seg = &((*cur_seg)->next );
}
seg->next = (*cur_seg);
(*cur_seg) = seg;
} else {
/* add segment to tail of unacked list */
useg->next = seg;
useg = useg->next;
}
seg->next = (*cur_seg);
(*cur_seg) = seg;
} else {
/* add segment to tail of unacked list */
useg->next = seg;
useg = useg->next;
}
}
/* do not queue empty segments on the unacked list */
Expand Down

0 comments on commit 712a978

Please sign in to comment.