lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #38468] tcp_sent() not called on half-open connection


From: Valery Ushakov
Subject: [lwip-devel] [bug #38468] tcp_sent() not called on half-open connection for data ACKed with the same ack as FIN
Date: Tue, 05 Mar 2013 02:12:07 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0

URL:
  <http://savannah.nongnu.org/bugs/?38468>

                 Summary: tcp_sent() not called on half-open connection for
data ACKed with the same ack as FIN
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: uwe
            Submitted on: Tue 05 Mar 2013 02:12:05 AM GMT
                Category: TCP
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: git head

    _______________________________________________________

Details:

I'm not sure if it's a bug or if I'm doing something wrong, so feel free
to close as invalid.

I have a pcb that ignores input and sends a blob of data as fast as it
can.  The client that connects to that pcb immediately half-closes after
connect.  When pcb is done sending it shuts down its end of the
connection too, it doesn't wait for all data to be acked before shutting
down, but it keeps tcp_sent() and tcp_err() callbacks in place and
tracks acks.

When peer receives all data and the FIN from the pcb it will send the
final datagram that ACKs _both_ the last bit of data and the FIN.

After calling tcp_process(), tcp_input() sees TF_CLOSED in recv_flags
and goes into that else-if branch that does TCP_EVENT_ERR(ERR_CLSD) and
doesn't do TCP_EVENT_SENT(pcb->acked) for the last chunk of acked data.

As a workaround I can do in my tcp_err() callback something along the
lisnes of:

    if (err == ERR_CLSD) {
       /* we know from RTFS that pcb is still alive at this point */
       struct tcp_pcb *pcb = /* get pcb from user data in arg */;

       if (pcb->acked > 0) {
           my_sent_callback(arg, pcb, pcb->acked);
       }
    }

which mimics missing TCP_EVENT_SENT (a few lines later in tcp_input() in
the else branch).





    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?38468>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

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