]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: threads/filters: Update trace filter to add _per_thread callbacks
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 27 Jul 2017 14:58:42 +0000 (16:58 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 12:58:32 +0000 (13:58 +0100)
src/flt_trace.c

index 96ce2ac58e51bc9bdc5001d9956051c9b4478da7..fa26de1fd34fb3a34228efc0845cb364b7bcd199 100644 (file)
@@ -15,6 +15,7 @@
 #include <common/standard.h>
 #include <common/time.h>
 #include <common/tools.h>
+#include <common/hathreads.h>
 
 #include <types/channel.h>
 #include <types/filters.h>
@@ -155,6 +156,26 @@ trace_check(struct proxy *px, struct flt_conf *fconf)
        return 0;
 }
 
+/* Initialize the filter for each thread. Return -1 on error, else 0. */
+static int
+trace_init_per_thread(struct proxy *px, struct flt_conf *fconf)
+{
+       struct trace_config *conf = fconf->conf;
+
+       TRACE(conf, "filter initialized for thread tid %u", tid);
+       return 0;
+}
+
+/* Free ressources allocate by the trace filter for each thread. */
+static void
+trace_deinit_per_thread(struct proxy *px, struct flt_conf *fconf)
+{
+       struct trace_config *conf = fconf->conf;
+
+       if (conf)
+               TRACE(conf, "filter deinitialized for thread tid %u", tid);
+}
+
 /**************************************************************************
  * Hooks to handle start/stop of streams
  *************************************************************************/
@@ -509,9 +530,11 @@ trace_tcp_forward_data(struct stream *s, struct filter *filter, struct channel *
  ********************************************************************/
 struct flt_ops trace_ops = {
        /* Manage trace filter, called for each filter declaration */
-       .init   = trace_init,
-       .deinit = trace_deinit,
-       .check  = trace_check,
+       .init              = trace_init,
+       .deinit            = trace_deinit,
+       .check             = trace_check,
+       .init_per_thread   = trace_init_per_thread,
+       .deinit_per_thread = trace_deinit_per_thread,
 
        /* Handle start/stop of streams */
        .attach             = trace_attach,