[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] Re: tcp_input: order of processing question/comment
From: |
Jakob Stoklund Olesen |
Subject: |
[lwip-devel] Re: tcp_input: order of processing question/comment |
Date: |
Wed, 04 Feb 2009 19:39:29 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
"bill" <address@hidden> writes:
> The questions are: Why would we want an error returned by the receive callback
> to prevent us from sending any pending data? Wouldn?t we still want to send
> queued ACKs or queued data?
It could also be an error from the tcp_sent callback. tcp_output is only
called if everything succeeds. I suppose in an attempt not to propagate
errors.
Is your receive callback returning errors? It should only do that is
serious cases like running out of memory.
> The comment is: It would seem to be better to call tcp_output *before* calling
> the tcp_recv callback. This would allow the other end of the connection to
> process any data that may be sent in that call while the lwIP side goes off
> and
> processes its data in the receive callback. In my bandwidth testing I do see
> slightly better performance by adding a tcp_output call before the receive
> callback.
The tcp_recv callback is likely to call tcp_write with a reply to the
data received. Calling tcp_output after the callback allows the ACK to
piggyback on the reply. If you call tcp_output first, it may send an
empty ACK segment only to be followed immediately by the reply.
The same goes for the tcp_sent callback.