]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] cfgparse: correctly count one socket per port in ranges
authorWilly Tarreau <w@1wt.eu>
Wed, 16 Feb 2011 10:08:57 +0000 (11:08 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Feb 2011 10:14:29 +0000 (11:14 +0100)
We used to only count one socket instead of one per listener. This makes
the socket count wrong, preventing from automatically computing the proper
number of sockets to bind.

This fix must be backported to 1.4 and 1.3.

src/cfgparse.c

index dd266af320fe1ad48e2eb8a032989a7efa4aad78..c588b466e937bc625c1bf4ca2250d5bd97dd88c5 100644 (file)
@@ -1431,8 +1431,8 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                                new->conf.file = file;
                                new->conf.line = linenum;
                                new = new->next;
+                               global.maxsock++;
                        }
-                       global.maxsock++;
                }
 
                /* set default values */
@@ -1633,6 +1633,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        new_listen->conf.file = file;
                        new_listen->conf.line = linenum;
                        new_listen = new_listen->next;
+                       global.maxsock++;
                }
 
                /* Set default global rights and owner for unix bind  */
@@ -1908,7 +1909,6 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        err_code |= ERR_ALERT | ERR_FATAL;
                        goto out;
                }
-               global.maxsock++;
                goto out;
        }
        else if (!strcmp(args[0], "monitor-net")) {  /* set the range of IPs to ignore */