lwip-users
[Top][All Lists]
Advanced

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

Re: Re: [lwip-users] Problem with multi file sending http server


From: Kieran Mansley
Subject: Re: Re: [lwip-users] Problem with multi file sending http server
Date: Thu, 25 Nov 2010 17:17:32 +0000

On Thu, 2010-11-25 at 17:57 +0100, Mariusz Dz wrote:
> >Can you show us the actual code?

There are a few things that look wrong here.

One of the first things you do in http_recv() is call tcp_recved().  I
would do that last, once you have finished with the data.

You also call pbuf_free() after taking a reference to p->payload.  This
sounds bad - the memory you're referencing could be reused by the stack.
Call pbuf_free() once you've finished with the data.

You specify your tcp_sent() callback after you've called send_data().
This is probably OK as you're doing this in the callback and so
preventing other things happening concurrently, but I would specify the
callback and then call send_data() as it makes more sense to me.

At the end of http_recv() you call close_conn().  This looks wrong too.
What will happen if not all the data were sent in send_data().
send_data() will only send some of the data if there isn't space for it
all in the send buffer.  You need to send the rest when you get your
sent callback.  If you close the connection before you've sent the rest
then you'll see things go wrong!

What does your http_sent() function do?

There may be more things that could be improved but the above all look
like you should solve those and then try again.

Thanks

Kieran






reply via email to

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