[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: |
Kieran Mansley |
Subject: |
Re: [lwip-users] netconn/netbuf api with receiving timeout missing closed connection |
Date: |
Wed, 28 Oct 2009 09:03:15 +0000 |
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:
http://savannah.nongnu.org/bugs/?27709
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.
Kieran