OK, I've just looked in more detail at pbuf_queue(). Just before the end
(pbuf.c:754), it does a pbuf_ref() on the packet being queued, so I think
etharp_queue() only needs to do a pbuf_ref() when putting the pointer directly
into the ARP table, and not when doing a pbuf_queue().
Cheers
Tony
-----Original Message-----
From: David Haas [mailto:address@hidden
Sent: 18 August 2004 16:34
To: lwip-devel
Subject: Re: [lwip-devel] Problem with UDP and ARP queuing
It turns out that
arp_table[i] = p;
and
pbuf_queue(arp_table[i].p, p);
really do the same thing: put p on the arp_table queue. The
reason they
are separate is that pbuf_queue() does not handle the case where the
queue is empty and therefore the first argument would be zero. If the
pbuf is being queued at all, then the arp table has a pointer to the
pbuf. Later when it takes the pbuf off the queue it will call
pbuf_free() with that pbuf pointer. So it needs to increment the
reference count when the pbuf is being queued.
David.
Mountifield, Tony wrote:
Sorry, wrong "if".
You have (effectively):
if (arp_table[i].p == NULL) {
arp_table[i].p = p;
} else {
pbuf_queue(arp_table[i].p, p);
}
pbuf_ref(p);
whereas I have:
if (arp_table[i].p == NULL) {
pbuf_ref(p);
arp_table[i].p = p;
} else {
pbuf_queue(arp_table[i].p, p);
}
I'm not sure which of the two is correct. It depends whether
queueing requires a refcnt increment, and if so, whether
pbuf_queue() handles it.
***********************************************************************************
This email, its content and any attachments is PRIVATE AND
CONFIDENTIAL to TANDBERG Television. If received in error please
notify the sender and destroy the original message and attachments.
www.tandbergtv.com
***********************************************************************************
_______________________________________________
lwip-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-devel