]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: spoe: Fix soft stop handler using a specific id for spoe filters
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 23 Feb 2017 09:17:15 +0000 (10:17 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 9 Mar 2017 14:32:55 +0000 (15:32 +0100)
During a soft stop, we need to wakeup all SPOE applets to stop them. So we loop
on all proxies, and for each proxy, on all filters. But we must be sure to only
handle SPOE filters here. To do so, we use a specific id.

src/flt_spoe.c

index 519d6bb5f505dcea9eb6cfc6aea00e952369370a..88f782ffcd82349ba8ec08bdd549a8a2282a0cb7 100644 (file)
@@ -235,6 +235,9 @@ struct spoe_context {
        unsigned int        process_exp;  /* expiration date to process an event */
 };
 
+/* SPOE filter id. Used to identify SPOE filters */
+const char *spoe_filter_id = "SPOE filter";
+
 /* Set if the handle on SIGUSR1 is registered */
 static int sighandler_registered = 0;
 
@@ -2282,10 +2285,16 @@ sig_stop_spoe(struct sig_handler *sh)
                struct flt_conf *fconf;
 
                list_for_each_entry(fconf, &p->filter_configs, list) {
-                       struct spoe_config *conf  = fconf->conf;
-                       struct spoe_agent  *agent = conf->agent;
+                       struct spoe_config *conf;
+                       struct spoe_agent  *agent;
                        struct appctx      *appctx;
 
+                       if (fconf->id != spoe_filter_id)
+                               continue;
+
+                       conf  = fconf->conf;
+                       agent = conf->agent;
+
                        list_for_each_entry(appctx, &agent->cache, ctx.spoe.list) {
                                si_applet_want_get(appctx->owner);
                                si_applet_want_put(appctx->owner);
@@ -3159,6 +3168,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
        }
 
        *cur_arg    = pos;
+       fconf->id   = spoe_filter_id;
        fconf->ops  = &spoe_ops;
        fconf->conf = conf;
        return 0;