output_thread: removed the old event loop DNS event type
output_thread: removed the old event loop DNS event type
handling code in favor of the custom event implementation
output_thread: removed the lookup_context cleanup list in favor of
a thread wide dns context that holds both the active and drop
lists
@@ -181,7 +181,7 @@ static void output_thread(void *data)
struct flb_output_coro *out_coro;
struct flb_out_thread_instance *th_ins = data;
struct flb_out_coro_params *params;
- struct mk_list lookup_context_cleanup_queue;
+ struct flb_net_dns dns_ctx;
/* Register thread instance */
flb_output_thread_instance_set(th_ins);
@@ -191,6 +191,10 @@ static void output_thread(void *data)
flb_coro_thread_init();
+ flb_net_ctx_init(&dns_ctx);
+ flb_net_dns_ctx_init();
+ flb_net_dns_ctx_set(&dns_ctx);
+
/*
* Expose the event loop to the I/O interfaces: since we are in a separate
* thread, the upstream connection interfaces need access to the event
@@ -238,8 +242,6 @@ static void output_thread(void *data)
}
event_local.type = FLB_ENGINE_EV_OUTPUT;
- mk_list_init(&lookup_context_cleanup_queue);
-
flb_plg_info(th_ins->ins, "worker #%i started", thread_id);
/* Thread event loop */
@@ -298,18 +300,6 @@ static void output_thread(void *data)
else if (event->type == FLB_ENGINE_EV_CUSTOM) {
event->handler(event);
}
- else if (event->type == FLB_ENGINE_EV_DNS) {
- struct flb_dns_lookup_context *lookup_context;
- lookup_context = FLB_DNS_LOOKUP_CONTEXT_FOR_EVENT(event);
-
- if (!lookup_context->finished) {
- event->handler(event);
-
- if (lookup_context->finished) {
- mk_list_add(&lookup_context->_head, &lookup_context_cleanup_queue);
- }
- }
- }
else if (event->type == FLB_ENGINE_EV_THREAD) {
/*
* Check if we have some co-routine associated to this event,
@@ -336,9 +326,11 @@ static void output_thread(void *data)
}
}
+ flb_net_dns_lookup_context_cleanup(&dns_ctx);
+
/* Destroy upstream connections from the 'pending destroy list' */
flb_upstream_conn_pending_destroy_list(&th_ins->upstreams);
- flb_net_dns_lookup_context_cleanup(&lookup_context_cleanup_queue);
+ flb_sched_timer_cleanup(sched);
/* Check if we should stop the event loop */
if (stopping == FLB_TRUE && mk_list_size(&th_ins->coros) == 0) {
