[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] queuelen accounting
From: |
Kieran Mansley |
Subject: |
Re: [lwip-devel] queuelen accounting |
Date: |
Wed, 24 Oct 2007 13:15:15 +0100 |
On Wed, 2007-10-24 at 12:15 +0100, Samuel Thibault wrote:
> There's a line of code I don't understand in the queuelen accounting: in
> tcp_out.c:247, "++queuelen;". Why is there such incrementation while
> queuelen is increased by pbuf_clen(seg->p) a few lines later? On the
> decreasing side, there is no corresponding --pcb->snd_queulen.
> Actually, dropping ++queuelen; makes the assertion always work...
That code is creating two pbufs - one for the headers, and one for the
payload. The two increments of the queuelen are for these two separate
pbufs. They are then chained together. The reason there is no
equivalent --pcb->snd_queuelen is that once they're chained pbuf_clen()
should then return the total length of both. So I think this code is
correct, if a little obfuscated. That's not to say there isn't a bug
elsewhere.
You don't say what code base you're using, or which assert is firing
(the code fragment you posted is in the code in two places). The
assertion is making the claim that if there are things in the send queue
(snd_queuelen != 0), there should be packets either in the unacked list
or the unsent list. So it looks like all the packets have been
acknowledged but the snd_queuelen hasn't gone to zero, which does rather
point at a problem like the one you suggest above.
Kieran