[Top][All Lists]

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

Re: [lwip-users] netconn/netbuf api with receiving timeout missing close

From: Dmitri Snejko
Subject: Re: [lwip-users] netconn/netbuf api with receiving timeout missing closed connection
Date: Fri, 30 Oct 2009 23:27:47 -0400
User-agent: Thunderbird (Windows/20090812)

On Sat, 2009-10-24 at 00:29 -0400, Dmitri Snejko wrote:
/ Hello,/
/ /
/> I am trying  to  use netconn api with receiving timeout other  then 0. I /
/> am using Lwip 1.3.0 with FreeRtos 5.4.2/ColdFire  and applied the patch /
/> for 1.3.1/
/> /
/> http://cvs.savannah.gnu.org/viewvc/lwip/src/include/lwip/err.h?root=lwip&r1=1.13&r2=1.14 
/>  /
/> <http://cvs.savannah.gnu.org/viewvc/lwip/src/include/lwip/err.h?root=lwip&r1=1.13&r2=1.14 
/> /
/> My application is a server listening for incoming connections, opening a /
/> new netconn for any client (telnet like) and allocates a static buffer /
/> from a pool to receive a stream. The receiving connection is not blocked /
/> any more and I found I have a problem  when the connection is closed on /
/> the remote side. My first impression was I could read netconn err field /
/> when netconn_recv returns NULL and based on the error code decide if the /
/> remote side closed the connection or a fatal error happened. That would /
/> be a reason to close the connection on the sever side. It works fine for /
/> some time but after a few hundred open/close cycles the server stops /
/> seeing the other side closed its end.  I assume  netconn_recv returns /
/> ERR_TIMEOUT which is not fatal. As result the buffer stays allocated and /
/> I am running out resources./

There was a bug reported recently about the way that netconn_recv deals
with the netconn->err field:


I hope that we will change the API for netconn_recv to return an error
like all the other netconn functions, rather than rely on the conn->err
field, but in the mean time you might like to try the partial fix
mentioned in that bug report.


I tried 1.3.1 and the last api_lib.c from SVC with a fix for netconn_recv. It is still loosing closed conditions. I think there is something more then just racing conditions in on netconn->err. I found if i use 0 timeout closed remote side cached well but if i close the client side suddenly on the middle of transition LwIP won't recover and close the connection with a timeout. It still keep it opened. Socket API build on netconn as well is doing well in all situations.

reply via email to

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