[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] [lwip] pcb->snd_nxt or pcb->snd_max?
From: |
H.J.W. |
Subject: |
[lwip-users] [lwip] pcb->snd_nxt or pcb->snd_max? |
Date: |
Wed, 08 Jan 2003 23:29:02 -0000 |
Hi!
I am trying to port lwip to a wireless environment without an OS. So I
simulate a high lost rate (25 will lost) network enviroment in PC and
experienced a lot of problems, most are retransmission related. Today I got a
'RST' segment from the peer in 'FIN_WAIT_2' state when trying to close a
connection. And I think I have found out the reason.
Here is a code piece from function "tcp_process":
case LAST_ACK:
tcp_receive(pcb);
if(flags & TCP_ACK && ackno == pcb->snd_nxt) {
DEBUGF(DEMO_DEBUG, ("TCP connection closed d -> d.\n", inseg.tcphdr->src,
inseg.tcphdr->dest));
pcb->state = CLOSED;
pcb->flags |= TF_CLOSED;
}
I believe it is safer to use 'pcb->snd_max' than 'pcb->snd_nxt' in
several places of function "tcp_process", because 'pcb->snd_nxt' may be
changed when "tcp_slowtmr" was called. For example, when the pcb send a 'FIN'
to destination,
but the segment was lost in the network, so the 'FIN' segment was placed in the
unacked queue together with other unacked segments, then "tcp_slowtmr" was
called, all unacked segments are moved to unsent queue exept the first unacked
segment, the 'pcb->snd_nxt' was changed to the seq number of the first unsent
segment, the first unacked segment was retransmited and was received by
destination. Then, a segment from destination with the ack number equal to
'pcb->snd_nxt' comes, well, what will happen in "tcp_process"? The pcb will be
purged and the 'FIN' segment will never transmit to destination!
And I really suggest to test lwip in tough network environment, for
example, 25% lost rate and 10 segments per second with only 32k byte data ram.
Regards!
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡H.J.W.
address@hidden
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2002-11-11
[This message was sent through the lwip discussion list.]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] [lwip] pcb->snd_nxt or pcb->snd_max?,
H.J.W. <=