Skip to content
Tcl Source Code History Of Ticket 0b9d3ba2ba3e1e3f
Login

History Of Ticket 0b9d3ba2ba3e1e3f

Artifacts Associated With Ticket 0b9d3ba2ba3e1e3f

  1. Ticket change [0cbc126208] (rid 149749) by cklein on 2016-11-17 17:13:28:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      Support for reuseport for UNIX sockets.
      The new socket option allows multiple sockets on the same host to bind to the same port, and is intended to improve the performance of multithreaded network server applications running on top of multicore systems.
      
      Without reuseport, you get the error: "couldn't open socket: address already in use"
      
      Patch:
      
      
      Index: unix/tclUnixSock.c
      ==================================================================
      --- unix/tclUnixSock.c
      +++ unix/tclUnixSock.c
      @@ -1428,10 +1428,13 @@
       				/* Callback for accepting connections from new
       				 * clients. */
           ClientData acceptProcData)	/* Data for the callback. */
       {
           int status = 0, sock = -1, reuseaddr = 1, chosenport;
      +#ifdef SO_REUSEPORT
      +    int reuseport = 1;
      +#endif
           struct addrinfo *addrlist = NULL, *addrPtr;	/* socket address */
           TcpState *statePtr = NULL;
           char channelName[SOCK_CHAN_LENGTH];
           const char *errorMsg = NULL;
           TcpFdList *fds = NULL, *newfds;
      @@ -1510,17 +1513,26 @@
       	 */
       
       	(void) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
       		(char *) &reuseaddr, sizeof(reuseaddr));
       
      +#ifdef SO_REUSEPORT
      +    /*
      +     * Set up to allows multiple sockets on the same host to bind to the same port.
      +     */
      +
      +    (void) setsockopt(sock, SOL_SOCKET, SO_REUSEPORT,
      +        (char *) &reuseport, sizeof(reuseport));
      +
               /*
                * Make sure we use the same port number when opening two server
                * sockets for IPv4 and IPv6 on a random port.
                *
                * As sockaddr_in6 uses the same offset and size for the port member
                * as sockaddr_in, we can handle both through the IPv4 API.
                */
      +#endif
       
       	if (port == 0 && chosenport != 0) {
       	    ((struct sockaddr_in *) addrPtr->ai_addr)->sin_port =
                           htons(chosenport);
       	}
      
    5. is_private initialized to: "0"
    6. login: "cklein"
    7. priority initialized to: "5 Medium"
    8. private_contact initialized to: "a15d90ba80f978cae526596013adf440a5f1f255"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "cklein"
    13. subsystem initialized to: "None"
    14. title initialized to: "Support for reuseport for UNIX sockets"
    15. type initialized to: "Patch"
  2. Add attachment "patch" [4ab24d086b] (rid 149750) by cklein on 2016-11-17 17:14:33.

  3. Ticket change [6c5962755b] (rid 149796) by jan.nijtmans on 2016-11-18 13:44:37:

    1. assignee changed to: "jan.nijtmans"
    2. icomment:
      Thanks for this submission. The patch as-is is not usable, as it would change the behavior (eating an error-message, which some people expect). At least, an option needs to be implemented somewhere (--reuseport or so), so the behavior is switchable.
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/plain"
  4. Add attachment "patch.002" [e01949821c] (rid 149799) by cklein on 2016-11-18 16:36:35.

  5. Ticket change [b3ec4a54f3] (rid 149813) by cklein on 2016-11-18 21:30:33:

    1. comment changed to:
      Support for reuseport for UNIX sockets.
      The new socket option allows multiple sockets on the same host to bind to the same port, and is intended to improve the performance of multithreaded network server applications running on top of multicore systems.
      
      Without reuseport, you get the error: "couldn't open socket: address already in use"
      
      New patch attached.
      
    2. login: "cklein"
    3. mimetype: "text/plain"
  6. Ticket change [b538870817] (rid 149847) by jan.nijtmans on 2016-11-22 10:09:03:

    1. icomment:
      Opened branch "tip-456", which can be used for this feature development.
      
      I'll be happy to be the sponsor of this TIP.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/plain"
    4. subsystem changed to: "18. Commands M-Z"
    5. type changed to: "RFE"
  7. Ticket change [35a10944b6] (rid 206182) by jan.nijtmans on 2022-10-28 22:47:52:

    1. closedate changed to: "2459881.4499135"
    2. closer changed to: "jan.nijtmans"
    3. icomment: "TIP #456 is final now"
    4. login: "jan.nijtmans"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"