void free_storage (void) { GModule module; tc_db_close (ht_agent_keys, get_dbname (DB_AGENT_KEYS, -1)); tc_db_close (ht_agent_vals, get_dbname (DB_AGENT_VALS, -1)); tc_db_close (ht_general_stats, get_dbname (DB_GEN_STATS, -1)); tc_db_close (ht_hostnames, get_dbname (DB_HOSTNAMES, -1)); tc_db_close (ht_unique_keys, get_dbname (DB_UNIQUE_KEYS, -1)); for (module = 0; module < TOTAL_MODULES; ++module) { free_tables (ht_storage[module].metrics, module); } }
static void house_keeping (void) { /* REVERSE DNS THREAD */ pthread_mutex_lock (&gdns_thread.mutex); /* kill dns pthread */ active_gdns = 0; free_holder (&holder); gdns_free_queue (); if (ht_hostnames != NULL) { #ifdef HAVE_LIBTOKYOCABINET tc_db_close (ht_hostnames, DB_HOSTNAMES); #else g_hash_table_destroy (ht_hostnames); #endif } pthread_mutex_unlock (&gdns_thread.mutex); /* DASHBOARD */ if (dash && !conf.output_html) { free_dashboard (dash); reset_find (); } /* GEOLOCATION */ #ifdef HAVE_LIBGEOIP if (geo_location_data != NULL) GeoIP_delete (geo_location_data); #endif /* STORAGE */ free_storage (); /* LOGGER */ free (logger); /* CONFIGURATION */ if (conf.debug_log) { LOG_DEBUG (("Bye.\n")); dbg_log_close (); } free_cmd_args (); }
static void free_tables (GStorageMetrics * metrics, GModule module) { /* Initialize metrics hash tables */ tc_db_close (metrics->keymap, get_dbname (DB_KEYMAP, module)); tc_db_close (metrics->datamap, get_dbname (DB_DATAMAP, module)); tc_db_close (metrics->rootmap, get_dbname (DB_ROOTMAP, module)); tc_db_close (metrics->uniqmap, get_dbname (DB_UNIQMAP, module)); tc_db_close (metrics->hits, get_dbname (DB_HITS, module)); tc_db_close (metrics->visitors, get_dbname (DB_VISITORS, module)); tc_db_close (metrics->bw, get_dbname (DB_BW, module)); tc_db_close (metrics->time_served, get_dbname (DB_AVGTS, module)); tc_db_close (metrics->methods, get_dbname (DB_METHODS, module)); tc_db_close (metrics->protocols, get_dbname (DB_PROTOCOLS, module)); #ifdef TCB_MEMHASH tc_db_close (metrics->agents, get_dbname (DB_AGENTS, module)); #endif #ifdef TCB_BTREE tc_bdb_close (metrics->agents, get_dbname (DB_AGENTS, module)); #endif }