|
From: | Mike Tesch |
Subject: | Re: [lwip-users] question about pbuf_chain |
Date: | Mon, 31 Mar 2003 14:31:52 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2) Gecko/20021202 |
Hey, I realized just after I sent it that I should have included a diff to show what I meant more clearly... The tot_len update never gets done if p->next is NULL... @@ -706,12 +706,14 @@ LWIP_ASSERT("t != NULL", t != NULL); /* proceed to last pbuf of chain */ - for (p = h; p->next != NULL; p = p->next) { + for (p = h; p != NULL; p = p->next) { /* add total length of second chain to all totals of first chain */ p->tot_len += t->tot_len; } Regards, mt David Haas wrote:
Hi,I had some questions about that code too, but I actually think it works. In the old definition of tot_len, it is only set in the first buffer of the chain. This code makes sure that's true and also sets it in the other buffers in the chain. Upon inspection, I think its OK, but I am just stepping through udp_send() now. I'll let you know what I find.regards, David. Mike Tesch wrote:Hello, I'm having a problem sending udp data through the sockets interface ;-)I think part of it is because pbuf_chain() is updating tot_len incorrectly. Just to clarify, tot_len is "the sum of 'len' of all pbufs following this one?"Is the following correct? (changed line marked by <<<<<<<) void pbuf_chain(struct pbuf *h, struct pbuf *t) { struct pbuf *p; LWIP_ASSERT("h != NULL", h != NULL); LWIP_ASSERT("t != NULL", t != NULL); /* proceed to last pbuf of chain */ for (p = h; p != NULL; p = p->next) { <<<<<<<< /* add total length of second chain to all totals of first chain */ p->tot_len += t->tot_len; } /* chain last pbuf of h chain (p) with first of tail (t) */ p->next = t; /* t is now referenced to one more time */ pbuf_ref(t);DEBUGF(PBUF_DEBUG | DBG_FRESH | 2, ("pbuf_chain: referencing tail %p\n", (void *) t));} _______________________________________________ lwip-users mailing list address@hidden http://mail.nongnu.org/mailman/listinfo/lwip-users_______________________________________________ lwip-users mailing list address@hidden http://mail.nongnu.org/mailman/listinfo/lwip-users
[Prev in Thread] | Current Thread | [Next in Thread] |