From: Roy Lee <[email protected]>
Sending a segment before it is added to the unacked list may result
a racing problem when it's ack is received before it got added to the
list.
---
src/core/tcp_out.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c
index 653ce4a..6b89596 100644
--- a/src/core/tcp_out.c
+++ b/src/core/tcp_out.c
@@ -573,7 +573,6 @@ tcp_output(struct tcp_pcb *pcb)
pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW);
}
- tcp_output_segment(seg, pcb);
pcb->snd_nxt = ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg);
if (TCP_SEQ_LT(pcb->snd_max, pcb->snd_nxt)) {
pcb->snd_max = pcb->snd_nxt;
@@ -600,8 +599,10 @@ tcp_output(struct tcp_pcb *pcb)
useg = useg->next;
}
}
- /* do not queue empty segments on the unacked list */
- } else {
+ }
+
+ tcp_output_segment(seg, pcb);
+ if (TCP_TCPLEN(seg) == 0) {
tcp_seg_free(seg);
}
seg = pcb->unsent;
--
1.6.2
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users