Exemple #1
0
/* ==================== exit_server_work_queue() ==================== */ 
int exit_server_work_queue(server_t *server)
{
	int i;

	for ( i = 0; i < RECV_THREADS; i++ ) {
        work_queue_t *wq = server->recv_queue[i];
        if ( wq != NULL ) {
            exit_work_queue(wq);
            zfree(wq);
            server->recv_queue[i] = NULL;
        }
	}

    for ( i = 0; i < SEND_THREADS; i++ ) {
        work_queue_t *wq = server->send_queue[i];
        if ( wq != NULL ) {
            exit_work_queue(wq);
            zfree(wq);
            server->send_queue[i] = NULL;
        }
    }

    /*pthread_key_delete(key_actived_sockbuf);*/

    return 0;
}
Exemple #2
0
void vnode_free(vnode_t *vnode){

    work_queue_t *wq = vnode->write_queue;
    if ( wq != NULL ) {
        exit_work_queue(wq);
        zfree(wq);
        vnode->write_queue = NULL;
    }

    if ( vnode->logFile != 0 ){
        close(vnode->logFile);
        vnode->logFile = 0;
    }

    if ( vnode->active_slicedb != NULL ){
        uint32_t active_slicedb_id = vnode->active_slicedb->id;
        for ( int db_id = 0 ; db_id < active_slicedb_id ; db_id++ ){
            if ( vnode->slicedbs[db_id] != NULL ){
                slicedb_free(vnode->slicedbs[db_id]);
                vnode->slicedbs[db_id] = NULL;
            }
        }
    }

    if ( vnode->kvdb_metadata != NULL ){
        kvdb_close(vnode->kvdb_metadata);
        vnode->kvdb_metadata = NULL;
    }

    if ( vnode->caching_objects != NULL ){
        object_queue_free(vnode->caching_objects);
        vnode->caching_objects = NULL;
    }

    listRelease(vnode->received_objects);
    vnode->received_object_size = 0;
    listRelease(vnode->standby_objects);
    vnode->standby_object_size = 0;

    /* Index DB */
    /*if ( vnode->kvdb != NULL ){*/
        /*kvdb_close(vnode->kvdb);*/
        /*vnode->kvdb = NULL;*/
    /*}*/

    /* datazones */
    int i;
    for ( i = 0 ; i < MAX_DATAZONES ; i++ ){
       if ( vnode->datazones[i] != NULL ){
           datazone_destroy(vnode->datazones[i]);
           zfree(vnode->datazones[i]);
       }
    }

    zfree(vnode);
}