lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #46696] accepts_pending not decreased when TCP_EVENT_A


From: Ambroz Bizjak
Subject: [lwip-devel] [bug #46696] accepts_pending not decreased when TCP_EVENT_ACCEPT returns error
Date: Mon, 18 Jan 2016 21:37:43 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36

Follow-up Comment #5, bug #46696 (project lwip):

Hey Joel,

I wasn't considering that. But the solution is fine for applications which use
the raw API directly and do not delay accepting the connection.

Actually, I think there is a minimally invasive way to go from this design to
one which limits SYN_RCVD plus the number of ESTABLISHED but not "fully
accepted" connections. That is:
- In the accept callback, decrement lpcb->backlog as you queue up the
connection for passing up to the application.
- Once you do finally pass the connection to the higher layer (the final
"accept"), increment lpcb->backlog.
- Also take care to increment lpcb->backlog if you abandon the connection
before passing it up.

By temporarily decrementing the lpcb->backlog, you effectively make lwIP
consider your half-accepted connections in the backlog size check when SYN
packets are received.

Actually, in my application I play with lpcb->backlog to limit the total
number of PCBs used for a service, preventing unintended closing of
connections for other services. To do this, I decrement lpcb->backlog in the
accept callback, and only increment it back when the connection is closed.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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