One question about codes of tcp_input in tcp_in.c

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

One question about codes of tcp_input in tcp_in.c

mud dog
Hi all:
When reading the tcp codes of lwIP, I made a question.
After calling the tcp_process in tcp_input, we determine
the return status and flags of tcp_process, when err != ERR_ABRT
and recv_flags' TF_RESET,TF_CLOSED is not set, call the tcp_output(pcb)
to send what? why do this?

    err = tcp_process(pcb);
    if (err != ERR_ABRT) {
      if (recv_flags & TF_RESET) {
       .................
      } else if (recv_flags & TF_CLOSED) {
       ...............
      } else {
          err = ERR_OK;
       ............
          if (err == ERR_OK) {
                 tcp_output(pcb);
             ~~~~~~~~~~~~why this line? to send what?
          }
     }
  }

thanks



_______________________________________________
lwip-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

Re: One question about codes of tcp_input in tcp_in.c

Kieran Mansley
On Sun, 2005-10-23 at 14:43 +0800, mud dog wrote:
> Hi all:
> When reading the tcp codes of lwIP, I made a question.
> After calling the tcp_process in tcp_input, we determine
> the return status and flags of tcp_process, when err != ERR_ABRT
> and recv_flags' TF_RESET,TF_CLOSED is not set, call the
> tcp_output(pcb)
> to send what? why do this?

I haven't looked at the code in detail to answer this, but my guess is
that it is to try to send any data that were queued because, for
example, there was no available TCP window space to send them.  After
receiving and processing a packet, it is likely that the acknowledgement
contained within it will allow more data to be sent, and so
tcp_output(pcb) is called.

Kieran



_______________________________________________
lwip-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-devel
Reply | Threaded
Open this post in threaded view
|

Re: One question about codes of tcp_input in tcp_in.c

mud dog
That seems right. Maybe some ack segment of new window has come,
tcp codes update the window, then call tcp_output to see there's some
datas to send.
Thanks

2005/10/24, Kieran Mansley <[hidden email]>:

> On Sun, 2005-10-23 at 14:43 +0800, mud dog wrote:
> > Hi all:
> > When reading the tcp codes of lwIP, I made a question.
> > After calling the tcp_process in tcp_input, we determine
> > the return status and flags of tcp_process, when err != ERR_ABRT
> > and recv_flags' TF_RESET,TF_CLOSED is not set, call the
> > tcp_output(pcb)
> > to send what? why do this?
>
> I haven't looked at the code in detail to answer this, but my guess is
> that it is to try to send any data that were queued because, for
> example, there was no available TCP window space to send them.  After
> receiving and processing a packet, it is likely that the acknowledgement
> contained within it will allow more data to be sent, and so
> tcp_output(pcb) is called.
>
> Kieran
>
>
>
> _______________________________________________
> lwip-devel mailing list
> [hidden email]
> http://lists.nongnu.org/mailman/listinfo/lwip-devel
>


_______________________________________________
lwip-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-devel