|
From: | address@hidden |
Subject: | Re: [lwip-devel] pbuf_cat() does not update total_len |
Date: | Tue, 03 Feb 2015 20:46:16 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
Laurenz Kamp wrote:
What confused me was that pbuf_cat() updates all tot_len fields in the first chain, but not in the second. Wouldn't it be sufficient to only update the tot_len field in the first pbuf of the first chain?
No, it wouldn't. tot_len is always the remaining length of the packet. That way you can just snip off the first pbuf in a chained packet, free it and be done. Without updating any fields of the remainder. The only place where this adds work is pbuf_cat(), but it makes the structure more fault proof.
Simon
[Prev in Thread] | Current Thread | [Next in Thread] |