]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cli: correctly remove the whole table on "clear table"
authorWilly Tarreau <w@1wt.eu>
Mon, 9 Jan 2012 10:50:03 +0000 (11:50 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 Jan 2012 10:53:09 +0000 (11:53 +0100)
Joe Price reported that "clear table xxx" sent on the CLI would only clear
the last entry. This is true, some code was missing to remove an entry from
within the loop, and only the final condition was able to remove an entry.
The fix is obvious. No backport is needed.

src/dumpstats.c

index f4d5c33c493dbdcf060061c3dd861e4bc7ce4045..12252c9d8642471af91db8d7ea98d61027a46be8 100644 (file)
@@ -3699,7 +3699,10 @@ static int stats_table_request(struct stream_interface *si, bool show)
                        if (eb) {
                                struct stksess *old = si->applet.ctx.table.entry;
                                si->applet.ctx.table.entry = ebmb_entry(eb, struct stksess, key);
-                               stksess_kill_if_expired(&si->applet.ctx.table.proxy->table, old);
+                               if (show)
+                                       stksess_kill_if_expired(&si->applet.ctx.table.proxy->table, old);
+                               else
+                                       stksess_kill(&si->applet.ctx.table.proxy->table, old);
                                si->applet.ctx.table.entry->ref_cnt++;
                                break;
                        }