Пример #1
0
/**
 * Close node stability caching.
 */
G_GNUC_COLD void
stable_close(void)
{
    dbstore_close(db_lifedata, settings_dht_db_dir(), db_stable_base);
    db_lifedata = NULL;
    cq_periodic_remove(&stable_sync_ev);
    cq_periodic_remove(&stable_prune_ev);
}
Пример #2
0
/**
 * Close GUID management.
 */
G_GNUC_COLD void
guid_close(void)
{
	dbstore_close(db_guid, settings_gnet_db_dir(), db_guid_base);
	db_guid = NULL;
	cq_periodic_remove(&guid_prune_ev);
	cq_periodic_remove(&guid_sync_ev);
}
Пример #3
0
/**
 * Close security token caching.
 */
void
tcache_close(void)
{
	dbstore_delete(db_tokdata);
	db_tokdata = NULL;
	cq_periodic_remove(&tcache_prune_ev);
}
Пример #4
0
/**
 * Get rid of a sub-queue, removing its heartbeat in the parent queue and
 * freeing the sub-queue object.
 */
static void
cq_subqueue_free(struct csubqueue *csq)
{
	csubqueue_check(csq);
	
	cq_periodic_remove(&csq->heartbeat);
	csq->sub_cq.cq_magic = 0;
	WFREE(csq);
}
Пример #5
0
/**
 * Final cleanup when application terminates.
 */
void
udp_close(void)
{
	if (udp_pings) {
		udp_ping_expire(TRUE);
		hash_list_free(&udp_pings);
	}

	cq_periodic_remove(&udp_ping_ev);
	aging_destroy(&udp_aging_pings);
}
Пример #6
0
/**
 * Close local key management.
 */
G_GNUC_COLD void
keys_close(void)
{
	values_close();

	dbstore_close(db_keydata, settings_dht_db_dir(), db_keybase);
	db_keydata = NULL;

	if (keys) {
		hikset_foreach(keys, keys_free_kv, NULL);
		hikset_free_null(&keys);
	}

	kuid_atom_free_null(&kball.furthest);
	kuid_atom_free_null(&kball.closest);

	gnet_stats_set_general(GNR_DHT_KEYS_HELD, 0);
	gnet_stats_set_general(GNR_DHT_CACHED_KEYS_HELD, 0);

	cq_cancel(&kball_ev);
	cq_periodic_remove(&keys_periodic_ev);
	cq_periodic_remove(&keys_sync_ev);
}
Пример #7
0
/**
 * Called at shutdown time.
 */
void
bg_close(void)
{
	guint count;

	count = bg_task_terminate_all(&runq);
	if (count > 0) {
		g_warning("terminated %u running task%s",
			count, count == 1 ? "" : "s");
	}

	count = bg_task_terminate_all(&sleepq);
	if (count > 0) {
		g_warning("terminated %d daemon task%s",
			count, count == 1 ? "" : "s");
	}

	bg_reclaim_dead();				/* Free dead tasks */
	bg_runcount = 0;
	cq_periodic_remove(&bg_ticker.pev);
}
Пример #8
0
/**
 * Destroy container, freeing all keys and values, and nullify pointer.
 */
void
aging_destroy(aging_table_t **ag_ptr)
{
	aging_table_t *ag = *ag_ptr;

	if (ag) {
		aging_check(ag);

		aging_synchronize(ag);

		hikset_foreach(ag->table, aging_free, ag);
		hikset_free_null(&ag->table);
		cq_periodic_remove(&ag->gc_ev);

		if (ag->lock != NULL) {
			mutex_destroy(ag->lock);
			WFREE(ag->lock);
		}

		ag->magic = 0;
		WFREE(ag);
		*ag_ptr = NULL;
	}
}