[Top][All Lists]

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

Re: [lwip-users] http server and pbuf overflow

From: Simon Goldschmidt
Subject: Re: [lwip-users] http server and pbuf overflow
Date: Tue, 19 Jan 2010 08:07:18 +0100

"Bernhard \'Gustl\' Bauer" wrote:
> This chained pbufs are new to me. I treated every call from tcp_recv as 
> if it contained only 1 pbuf = packet.

For RX, that depends on your driver and might well be true for simple cases. 
However if you enable out-of-sequence queueing (TCP_QUEUE_OOSEQ, enabled by 
default), you can get multiple (queued) packets with one recv call. Just check 
if p->next is != NULL. Still, calling pbuf_free() on the first pbuf of this 
queue should be enough, so your pbuf leak is probably somewhere else.

How do you know you have a leak, anyway? Does your device stall? Or is it only 
temporary? Maybe you just configured the number of pbufs too low?

> Don't I get a tcp_err in this case? This would free pbuf.

That depends on the remote side. If you simply switch off the remote side or 
unplug its cable, you won't get a tcp_err (or not for some time, at least): 
tcp_err is called when the remote side sends a RST or your connection times out 
(and timing out can be a long time for TCP if the remote side simply doesn't 
answer at all).

Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser

reply via email to

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