lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] pbuf question


From: Tim Newsham
Subject: [lwip-users] pbuf question
Date: Fri, 9 Jul 2004 14:22:04 -1000 (HST)

Hi,  I'm receiving pbufs from the tcp receive callback and I need
to queue several buffers up so I figure, hey, I'll use the pbufs.

The code isn't working as I hoped, and I guess I misunderstand
the pbuf api.

When I get the first pbuf, I set my queue variable to be equal
to it.  On subsequent pbufs I use pbuf_chain(queue, p) to add
the pbuf to the chain.

Now when I want to take data off the pbuf I use pbuf_header
to pop off a certain number of bytes if I only take a partial
buffer worth, or pbuf_dechain if I take a whole buffers worth.
However, pbuf_dechain is doing:

    tail_gone = pbuf_free(q)

and returning NULL for next when tail_gone returns true.

I'm looking at the references.  Each pbuf I receive has a
reference of 1 when I get it.  At the point I want to
start dechaining, I have a total of 4 pbufs in the chain
with refcounts of:  1,1,2,1!

Why does one of the pbufs have a higher reference count?
Am I supposed to bump up the reference count while chaining
these things together?  What am I doing wrong here?

Tim N.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]