From 02adc353d51b5b62e90e8a90358acb2ffeda3cc9 Mon Sep 17 00:00:00 2001 From: Leonardo Alminana Date: Thu, 22 Jul 2021 16:52:06 -0300 Subject: [PATCH] network: moved the response event back to the base of the lookup context and removed the string comparisson to determine which dns mode we are using Signed-off-by: Leonardo Alminana --- include/fluent-bit/flb_network.h | 4 ++-- src/flb_network.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/fluent-bit/flb_network.h b/include/fluent-bit/flb_network.h index e019e22d9e1..4c654c49310 100644 --- a/include/fluent-bit/flb_network.h +++ b/include/fluent-bit/flb_network.h @@ -44,7 +44,7 @@ struct flb_net_setup { /* maximum of times a keepalive connection can be used */ int keepalive_max_recycle; - /* dns mode : FLB_DNS_USE_TCP, FLB_DNS_USE_UDP */ + /* dns mode : TCP or UDP */ char *dns_mode; }; @@ -60,10 +60,10 @@ struct flb_net_host { /* Defines an async DNS lookup context */ struct flb_dns_lookup_context { + struct mk_event response_event; /* c-ares socket event */ int *udp_timeout_detected; int ares_socket_created; int ares_socket_type; - struct mk_event response_event; /* c-ares socket event */ void *ares_channel; int *result_code; struct mk_event_loop *event_loop; diff --git a/src/flb_network.c b/src/flb_network.c index ba194979bd1..4d163554295 100644 --- a/src/flb_network.c +++ b/src/flb_network.c @@ -744,9 +744,8 @@ int flb_net_getaddrinfo(const char *node, const char *service, struct addrinfo * dns_mode = FLB_DNS_USE_UDP; - if (dns_mode_textual != NULL && - strncasecmp(dns_mode_textual, "TCP", 3) == 0) { - dns_mode = FLB_DNS_USE_TCP; + if (dns_mode_textual != NULL) { + dns_mode = toupper(dns_mode_textual[0]); } event_loop = flb_engine_evl_get();