Skip to content

Commit

Permalink
input: initialize flb_input libco parameters using FLB_TLS macros.
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Whelan <[email protected]>
  • Loading branch information
pwhelan committed Sep 27, 2023
1 parent 74a23ab commit 9c94a76
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/flb_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
#include <fluent-bit/flb_chunk_trace.h>
#endif /* FLB_HAVE_CHUNK_TRACE */

struct flb_libco_in_params libco_in_param;
pthread_key_t libco_in_param_key;
FLB_TLS_DEFINE(struct flb_in_collect_params, in_collect_params);

#define protcmp(a, b) strncasecmp(a, b, strlen(a))

Expand Down Expand Up @@ -141,6 +140,23 @@ int flb_input_log_check(struct flb_input_instance *ins, int l)
return FLB_TRUE;
}

/* Prepare input co-routines for the thread. */
void flb_input_prepare()
{
FLB_TLS_INIT(in_collect_params);
}

void flb_input_unprepare()
{
struct flb_in_collect_params *params;

params = (struct flb_in_collect_params *)FLB_TLS_GET(in_collect_params);
if (params) {
flb_free(params);
FLB_TLS_SET(in_collect_params, NULL);
}
}

/* Create an input plugin instance */
struct flb_input_instance *flb_input_new(struct flb_config *config,
const char *input, void *data,
Expand Down Expand Up @@ -1313,6 +1329,8 @@ void flb_input_exit_all(struct flb_config *config)
/* destroy the instance */
flb_input_instance_destroy(ins);
}

flb_input_unprepare();
}

/* Check that at least one Input is enabled */
Expand Down

0 comments on commit 9c94a76

Please sign in to comment.