]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MEDIUM] reverse internal proxy declaration order to match configuration
authorWilly Tarreau <w@1wt.eu>
Sun, 15 Mar 2009 13:51:53 +0000 (14:51 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 15 Mar 2009 13:51:53 +0000 (14:51 +0100)
People are regularly complaining that proxies are linked in reverse
order when reading the stats. This is now definitely fixed because
the proxy order is now fixed to match configuration order.

src/cfgparse.c

index 1158988ffedda6df3ab9283e500ecdfbb21c5ec6..c3344738a907d6d9502221fa334fd9882a6a41b9 100644 (file)
@@ -3096,6 +3096,19 @@ int readcfgfile(const char *file)
        /* will be needed further to delay some tasks */
        tv_update_date(0,1);
 
+       /* first, we will invert the proxy list order */
+       curproxy = NULL;
+       while (proxy) {
+               struct proxy *next;
+
+               next = proxy->next;
+               proxy->next = curproxy;
+               curproxy = proxy;
+               if (!next)
+                       break;
+               proxy = next;
+       }
+
        if ((curproxy = proxy) == NULL) {
                Alert("parsing %s : no <listen> line. Nothing to do !\n",
                      file);