]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] debug: report the correct poller list in verbose mode
authorWilly Tarreau <w@1wt.eu>
Fri, 19 Nov 2010 09:20:36 +0000 (10:20 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 19 Nov 2010 12:25:10 +0000 (13:25 +0100)
When running with -vv or -V -d, the list of usable polling systems
is reported. The final selection did not take into account the
possible failures during the tests, which is misleading and could
make one think that a non-working poller will be used, while it is
not the case. Fix that to really report the correct ones.
(cherry picked from commit 6d0e354e0171f08b7b3868ad2882c3663bd068a7)

src/fd.c

index c850efa7971294b181f6173197a6524cf685aeb8..80bddd6a0f78863801d7f02f49e2bb6d4ded9a84 100644 (file)
--- a/src/fd.c
+++ b/src/fd.c
@@ -119,11 +119,12 @@ int list_pollers(FILE *out)
        last = next = -1;
        while (1) {
                for (p = 0; p < nbpollers; p++) {
-                       if (!bp || (pollers[p].pref > bp->pref))
-                               bp = &pollers[p];
                        if ((next < 0 || pollers[p].pref > next)
-                           && (last < 0 || pollers[p].pref < last))
+                           && (last < 0 || pollers[p].pref < last)) {
                                next = pollers[p].pref;
+                               if (!bp || (pollers[p].pref > bp->pref))
+                                       bp = &pollers[p];
+                       }
                }
 
                if (next == -1)
@@ -140,8 +141,11 @@ int list_pollers(FILE *out)
                                        fprintf(out, " test result OK");
                                        if (next > 0)
                                                usable++;
-                               } else
+                               } else {
                                        fprintf(out, " test result FAILED");
+                                       if (bp == &pollers[p])
+                                               bp = NULL;
+                               }
                                fprintf(out, "\n");
                        }
                }