lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] http_sent cb shows 1 byte trailer [RAW]


From: Kieran Mansley
Subject: Re: [lwip-users] http_sent cb shows 1 byte trailer [RAW]
Date: Tue, 11 Aug 2009 08:57:39 +0100

There is a lot of confusion in this thread about these two issues, but I
think I understand what's happening.

The first issue, receiving an extra "sent" callback with len 1 at the
end of a transfer, is due to getting the ACK from the other side for our
FIN, which causes TCP_EVENT_SENT() to be called (src/core/tcp_in.c line
317).  This is not a big problem, but I can see that it's confusing
behaviour and not ideal, so a bug has been filed and it will get fixed
I'm sure.

The second issue, double call to close_conn(), is entirely due to the
way the application is structured, and not a bug in lwIP itself.  If you
look at the httpserver_raw example, which I'm guessing is rather similar
to the actual code Chris is using, it calls close_conn() for a number of
reasons.  This might be because the connection has been closed by the
other end (pbuf == NULL) or due to some error that it has detected
(extra sent callback - see above).

In the pbuf == NULL case you might not notice http_recv() handling this
as it should do so silently and call close_conn() for you.  The only way
to be 100% sure what events are leading to the two calls to close_conn()
are to trace it in your application - this function is not called
directly by lwIP.

However, as far as I can tell, this isn't causing any problems.  I'm
guessing that whoever wrote the example application intended
close_conn() to be possibly called multiple times, so I wouldn't worry
about it.

Kieran





reply via email to

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