patchlwIP - A Lightweight TCP/IP stack - Patches: patch #8764, Allow backlog to be updated

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #8764: Allow backlog to be updated

Submitter:  Joel Cunningham <jcunningham>
Submitted:  Thu 08 Oct 2015 04:57:01 PM UTC
   
 
Category:  sockets/netconn Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  jcunningham Open/Closed:  Closed
Planned Release:  None

Jump to the original submission

Thu 25 Feb 2016 09:35:40 PM UTC, comment #7: 

Patch submitted in 8cb64698aad3e34aa45f0c6cb9592563d24c3cd0

Joel Cunningham <jcunningham>
Group Member
Thu 25 Feb 2016 09:08:05 PM UTC, comment #6: 

Great, I'll make sure the patch is updated for current master and submit it.

Joel Cunningham <jcunningham>
Group Member
Thu 25 Feb 2016 07:48:34 PM UTC, comment #5: 

Alright, that's true.

Simon Goldschmidt <goldsimon>
Group administrator
Wed 24 Feb 2016 09:55:21 PM UTC, comment #4: 

Thanks for the explanation of tcp_priv.h, by applications do you mean callers of the raw TCP API, which includes netconn/sockets code?

The question of should tcp_backlog_set() be in tcp.h or tcp_priv.h, I was thinking it should go in tcp.h so that users of the raw API (either an application or netconn/sockets) could use it.  My patch calls tcp_backlog_set() from lwip_netconn_do_listen() in api_msg.c in addition to tcp.c

Joel Cunningham <jcunningham>
Group Member
Thu 18 Feb 2016 06:11:13 PM UTC, comment #3: 

Oh, I see. I haven't tried compiling with the define in the priv header.

The idea behind the priv headers was to make it clearer what's the API that applications should use and what's internal stuff. That was stated nowhere before...

Simon Goldschmidt <goldsimon>
Group administrator
Thu 18 Feb 2016 03:32:48 PM UTC, comment #2: 

I had placed the new macro tcp_backlog_set() in tcp.h alongside tcp_accepted() because the function is called from lwip_netconn_do_listen() in api_msg.c in addition to tcp_listen_with_backlog().  If using the raw API, applications could call this to update the backlog.

I'm not 100% up to speed on the architectural change that came along with tcp_priv.h, but was that created for includes that only LwIP TCP code should be using and not any raw applications (including netconn)?

Joel Cunningham <jcunningham>
Group Member
Thu 18 Feb 2016 08:32:49 AM UTC, comment #1: 

Aside from the fact that the macro should now go to tcp_priv.h, the patch looks good. I don't know how other systems handle updating backlog, but it's OK for me to change it at runtime :-)

Simon Goldschmidt <goldsimon>
Group administrator
Thu 08 Oct 2015 04:57:01 PM UTC, original submission:  

I've created a patch that adds support to the sockets/netconn layer for updating the backlog of a listening socket.  Reducing the size of the backlog will not abort queued connections, but instead prevent new connections until pcb->accept_pending < pcb->backlog

This is supported on POSIX systems by calling listen again with the new backlog value when the socket is already in the listen state: http://manpages.ubuntu.com/manpages/jaunty/man2/listen.2freebsd.html

Winsock allows calling listen again once in the listen state, but doesn't adjust the backlog value: https://msdn.microsoft.com/en-us/library/windows/desktop/ms739168%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

Open Group doesn't specify this as a required behavior, but it was really easy to support on LwIP

http://pubs.opengroup.org/onlinepubs/009695399/functions/listen.html

The patch also adds a macro for setting the backlog, ensuring that the backlog is not set to 0 (this logic was previously in tcp_listen_with_backlog())

Joel Cunningham <jcunningham>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #35105:  0001-Allow-backlog-to-be-updated.patch added by jcunningham (3KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by jcunningham (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-25 jcunningham StatusNone Done
        Open/ClosedOpen Closed
    2015-10-08 jcunningham Attached File- Added 0001-Allow-backlog-to-be-updated.patch, #35105

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code