From 17699033eec45300f60422bebc3861e1aaad82da Mon Sep 17 00:00:00 2001 From: Leonardo Alminana Date: Thu, 20 Jul 2023 13:59:13 +0200 Subject: [PATCH] connection: a shutdown guard flag was added Signed-off-by: Leonardo Alminana --- include/fluent-bit/flb_upstream_conn.h | 8 ++++++++ src/flb_upstream.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/include/fluent-bit/flb_upstream_conn.h b/include/fluent-bit/flb_upstream_conn.h index 08e2741cef7..73663713743 100644 --- a/include/fluent-bit/flb_upstream_conn.h +++ b/include/fluent-bit/flb_upstream_conn.h @@ -66,6 +66,14 @@ struct flb_upstream_conn { */ int busy_flag; + /* This flag is used to determine if the connection was shut down to ensure we + * don't do it twice when a timeout is detected. + * + * This is required in order to overcome a limitation in the async read / write + * functions that will be addressed as soon as possible. + */ + int shutdown_flag; + /* Timestamps */ time_t ts_assigned; time_t ts_created; diff --git a/src/flb_upstream.c b/src/flb_upstream.c index 14504807a5c..dd16c3edb8a 100644 --- a/src/flb_upstream.c +++ b/src/flb_upstream.c @@ -560,6 +560,8 @@ static struct flb_upstream_conn *create_conn(struct flb_upstream *u) conn->ts_available = 0; conn->ka_count = 0; conn->coro = coro; + conn->busy_flag = FLB_FALSE; + conn->shutdown_flag = FLB_FALSE; if (u->net.keepalive == FLB_TRUE) { flb_upstream_conn_recycle(conn, FLB_TRUE);