Ejemplo n.º 1
0
/* FIXME: Invalid free... */
void
file_cache_free (struct file_cache *tree) {
    if (tree) {
        file_cache_free (tree->left);
        file_cache_free (tree->right);
        __file_cache_free (tree);
    }
}
Ejemplo n.º 2
0
static void squat_uidlist_close(struct squat_uidlist *uidlist)
{
	i_assert(!uidlist->building);

	squat_uidlist_unmap(uidlist);
	if (uidlist->file_cache != NULL)
		file_cache_free(&uidlist->file_cache);
	if (uidlist->file_lock != NULL)
		file_lock_free(&uidlist->file_lock);
	if (uidlist->dotlock != NULL)
		file_dotlock_delete(&uidlist->dotlock);
	if (uidlist->fd != -1) {
		if (close(uidlist->fd) < 0)
			i_error("close(%s) failed: %m", uidlist->path);
		uidlist->fd = -1;
	}
	uidlist->corrupted = FALSE;
}
Ejemplo n.º 3
0
static void
server_stop (int sig) {
    struct client   *c;
    struct daemon   *d;

    pool_destroy (slow_pool);
    pool_destroy (fast_pool);
    pool_destroy (clients_pool);
    pool_destroy (daemons_pool);

    (void) sig;
    log_failure (log_file, "Ok, received a signal");
    sleep (2);

    sem_destroy (&clients_lock);
    sem_destroy (&daemons_lock);
    sem_destroy (&file_cache_lock);
    sem_destroy (&downloads_lock);

    if (clients) {
        while (clients) {
            c = clients->next;
            client_free (clients);
            clients = c;
        }
        log_success (log_file,
                     "%s : all clients have been freed",
                     __func__);
    }

    if (daemons) {
        while (daemons) {
            d = daemons->next;
            daemon_send (daemons, "quit\n");
            daemon_free (daemons);
            daemons = d;
        }
        log_success (log_file,
                     "%s : all daemons have been freed",
                     __func__);
    }

    if (file_cache) {
        file_cache_free (file_cache);
        log_success (log_file,
                     "%s : file cache has been freed",
                     __func__);
    }

    if (unlink (prefs->lock_file) < 0)
        if (log_file)
            log_failure (log_file, "Could not destroy the lock file");
    if (prefs) {
        conf_free (prefs);
        log_success (log_file,
                     "%s : Preferences have been freed.",
                     __func__);
    }

    if (log_file) {
        log_success (log_file, "Stopping server, waiting for SIGKILL");
        fclose (log_file);
    }

    exit (EXIT_SUCCESS);
}