Skip to content

Commit

Permalink
Merge pull request elastic#34 from balabit/merge/h/cfg-old-reload-crash
Browse files Browse the repository at this point in the history
mainloop: Deinit the dns thread cache when reverting the config
  • Loading branch information
bazsi committed Dec 10, 2013
2 parents 955b9f3 + 0b2065d commit df38501
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
2 changes: 2 additions & 0 deletions lib/apphook.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ app_startup(void)
iv_init();
g_thread_init(NULL);
dns_cache_global_init();
dns_cache_thread_init();
afinter_global_init();
child_manager_init();
alarm_init();
Expand Down Expand Up @@ -162,6 +163,7 @@ app_shutdown(void)
child_manager_deinit();
g_list_foreach(application_hooks, (GFunc) g_free, NULL);
g_list_free(application_hooks);
dns_cache_thread_deinit();
dns_cache_global_deinit();
msg_deinit();
iv_deinit();
Expand Down
2 changes: 0 additions & 2 deletions lib/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ cfg_init(GlobalConfig *cfg)
log_tags_reinit_stats(cfg);

dns_cache_set_params(cfg->dns_cache_size, cfg->dns_cache_expire, cfg->dns_cache_expire_failed, cfg->dns_cache_hosts);
dns_cache_thread_init();
hostname_reinit(cfg->custom_domain);
host_resolve_options_init(&cfg->host_resolve_options, cfg);
log_proto_register_builtin_plugins(cfg);
Expand All @@ -229,7 +228,6 @@ cfg_init(GlobalConfig *cfg)
gboolean
cfg_deinit(GlobalConfig *cfg)
{
dns_cache_thread_deinit();
return cfg_tree_stop(&cfg->tree);
}

Expand Down
4 changes: 0 additions & 4 deletions tests/unit/test_dnscache.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ test_expiration(void)
gboolean positive;

dns_cache_set_params(50000, 3, 1, NULL);
dns_cache_thread_init();

for (i = 0; i < 10000; i++)
{
Expand Down Expand Up @@ -107,7 +106,6 @@ test_expiration(void)
exit(1);
}
}
dns_cache_thread_deinit();
}

void
Expand All @@ -120,7 +118,6 @@ test_dns_cache_benchmark(void)
gint i;

dns_cache_set_params(50000, 600, 300, NULL);
dns_cache_thread_init();

for (i = 0; i < 10000; i++)
{
Expand All @@ -143,7 +140,6 @@ test_dns_cache_benchmark(void)
}
g_get_current_time(&end);
printf("DNS cache speed: %12.3f iters/sec\n", i * 1e6 / g_time_val_diff(&end, &start));
dns_cache_thread_deinit();
}

int
Expand Down

0 comments on commit df38501

Please sign in to comment.