Skip to content

Commit

Permalink
in_forward: Synchronize is_paused state and deleting conns
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 authored and edsiper committed Dec 13, 2024
1 parent 470bb18 commit dee6d12
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions plugins/in_forward/fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,14 +360,14 @@ static void in_fw_pause(void *data, struct flb_config *config)
{
struct flb_in_fw_config *ctx = data;
if (config->is_running == FLB_TRUE) {
/*
* This is the case when we are not in a shutdown phase, but
* backpressure built up, and the plugin needs to
* pause the ingestion. The plugin should close all the connections
* and wait for the ingestion to resume.
*/
flb_input_collector_pause(ctx->coll_fd, ctx->ins);
if (pthread_mutex_lock(&ctx->conn_mutex)) {
/*
* This is the case when we are not in a shutdown phase, but
* backpressure built up, and the plugin needs to
* pause the ingestion. The plugin should close all the connections
* and wait for the ingestion to resume.
*/
flb_input_collector_pause(ctx->coll_fd, ctx->ins);
fw_conn_del_all(ctx);
ctx->is_paused = FLB_TRUE;
}
Expand All @@ -390,8 +390,8 @@ static void in_fw_pause(void *data, struct flb_config *config)
static void in_fw_resume(void *data, struct flb_config *config) {
struct flb_in_fw_config *ctx = data;
if (config->is_running == FLB_TRUE) {
flb_input_collector_resume(ctx->coll_fd, ctx->ins);
if (pthread_mutex_lock(&ctx->conn_mutex)) {
flb_input_collector_resume(ctx->coll_fd, ctx->ins);
ctx->is_paused = FLB_FALSE;
}
pthread_mutex_unlock(&ctx->conn_mutex);
Expand Down

0 comments on commit dee6d12

Please sign in to comment.