Ejemplo n.º 1
0
int dbt_init_cache()
{
	if(!_cachesem)
	{
	/* init locks */
		_cachesem = lock_alloc();
		if(!_cachesem)
		{
			LOG(L_CRIT,"dbtext:dbt_init_cache: could not alloc a lock\n");
			return -1;
		}
		if (lock_init(_cachesem)==0)
		{
			LOG(L_CRIT,"dbtext:dbt_init_cache: could not intialize a lock\n");
			lock_dealloc(_cachesem);
			return -1;
		}
	}
	/* init pointer to caches list */
	if (!_cachedb) {
		_cachedb = shm_malloc( sizeof(dbt_cache_p) );
		if (!_cachedb) {
			LOG(L_CRIT,"dbtext:dbt_init_cache: no enough shm mem\n");
			lock_dealloc(_cachesem);
			return -1;
		}
		*_cachedb = NULL;
	}
	
	return 0;
}
Ejemplo n.º 2
0
int wsconn_init(void)
{
	wsconn_lock = lock_alloc();
	if (wsconn_lock == NULL)
	{
		LM_ERR("allocating lock\n");
		goto error;
	}
	if (lock_init(wsconn_lock) == 0)
	{
		LM_ERR("initialising lock\n");
		goto error;
	}

	wsstat_lock = lock_alloc();
	if (wsstat_lock == NULL)
	{
		LM_ERR("allocating lock\n");
		goto error;
	}
	if (lock_init(wsstat_lock) == NULL)
	{
		LM_ERR("initialising lock\n");
		goto error;
	}

	wsconn_id_hash =
		(ws_connection_t **) shm_malloc(TCP_ID_HASH_SIZE *
						sizeof(ws_connection_t*));
	if (wsconn_id_hash == NULL)
	{
		LM_ERR("allocating WebSocket hash-table\n");
		goto error;
	}
	memset((void *) wsconn_id_hash, 0,
		TCP_ID_HASH_SIZE * sizeof(ws_connection_t *));

	wsconn_used_list = (ws_connection_used_list_t *) shm_malloc(
					sizeof(ws_connection_used_list_t));
	if (wsconn_used_list == NULL)
	{
		LM_ERR("allocating WebSocket used list\n");
		goto error;
	}
	memset((void *) wsconn_used_list, 0, sizeof(ws_connection_used_list_t));

	return 0;

error:
	if (wsconn_lock) lock_dealloc((void *) wsconn_lock);
	if (wsstat_lock) lock_dealloc((void *) wsstat_lock);
	wsconn_lock = wsstat_lock = NULL;

	if (wsconn_id_hash) shm_free(wsconn_id_hash);
	if (wsconn_used_list) shm_free(wsconn_used_list);
	wsconn_id_hash = NULL;
	wsconn_used_list = NULL;

	return -1;
}
Ejemplo n.º 3
0
int init_tcp()
{
	/* init lock */
	tcpconn_lock=lock_alloc();
	if (tcpconn_lock==0){
		LOG(L_CRIT, "ERROR: init_tcp: could not alloc lock\n");
		goto error;
	}
	if (lock_init(tcpconn_lock)==0){
		LOG(L_CRIT, "ERROR: init_tcp: could not init lock\n");
		lock_dealloc((void*)tcpconn_lock);
		tcpconn_lock=0;
		goto error;
	}
	/* init globals */
	connection_id=(int*)shm_malloc(sizeof(int));
	if (connection_id==0){
		LOG(L_CRIT, "ERROR: init_tcp: could not alloc globals\n");
		lock_destroy(tcpconn_lock);
		lock_dealloc((void*)tcpconn_lock);
		tcpconn_lock=0;
		goto error;
	}
	*connection_id=1;
	/* alloc hashtables*/
	tcpconn_addr_hash=(struct tcp_connection**)shm_malloc(TCP_ADDR_HASH_SIZE*
								sizeof(struct tcp_connection*));

	if (tcpconn_addr_hash==0){
		LOG(L_CRIT, "ERROR: init_tcp: could not alloc address hashtable\n");
		shm_free(connection_id);
		connection_id=0;
		lock_destroy(tcpconn_lock);
		lock_dealloc((void*)tcpconn_lock);
		tcpconn_lock=0;
		goto error;
	}
	
	tcpconn_id_hash=(struct tcp_connection**)shm_malloc(TCP_ID_HASH_SIZE*
								sizeof(struct tcp_connection*));
	if (tcpconn_id_hash==0){
		LOG(L_CRIT, "ERROR: init_tcp: could not alloc id hashtable\n");
		shm_free(connection_id);
		connection_id=0;
		shm_free(tcpconn_addr_hash);
		tcpconn_addr_hash=0;
		lock_destroy(tcpconn_lock);
		lock_dealloc((void*)tcpconn_lock);
		tcpconn_lock=0;
		goto error;
	}
	/* init hashtables*/
	memset((void*)tcpconn_addr_hash, 0, 
			TCP_ADDR_HASH_SIZE * sizeof(struct tcp_connection*));
	memset((void*)tcpconn_id_hash, 0, 
			TCP_ID_HASH_SIZE * sizeof(struct tcp_connection*));
	return 0;
error:
		return -1;
}
Ejemplo n.º 4
0
/**
 * Destroys the session related structures.
 */
int cdp_sessions_destroy()
{
	int i;
	cdp_session_t *n,*x;

	if (session_lock){
		lock_get(session_lock);
		lock_destroy(session_lock);
		lock_dealloc((void*)session_lock);
		session_lock=0;
	}
	for(i=0;i<sessions_hash_size;i++){
		AAASessionsLock(i);
		for(x = sessions[i].head; x; x = n){
			n = x->next;
			free_session(x);
		}
		lock_destroy(sessions[i].lock);
		lock_dealloc((void*)sessions[i].lock);
	}
	shm_free(sessions);

	shm_free(session_id1);
	shm_free(session_id2);
	return 1;
}
Ejemplo n.º 5
0
int dbt_init_cache(void)
{
	int i, j;
	if(!_dbt_cachesem)
	{
	/* init locks */
		_dbt_cachesem = lock_alloc();
		if(!_dbt_cachesem)
		{
			LM_CRIT("could not alloc a lock\n");
			return -1;
		}
		if (lock_init(_dbt_cachesem)==0)
		{
			LM_CRIT("could not initialize a lock\n");
			lock_dealloc(_dbt_cachesem);
			return -1;
		}
	}
	/* init pointer to caches list */
	if (!_dbt_cachedb) {
		_dbt_cachedb = shm_malloc( sizeof(dbt_cache_p) );
		if (!_dbt_cachedb) {
			LM_CRIT("no enough shm mem\n");
			lock_dealloc(_dbt_cachesem);
			return -1;
		}
		*_dbt_cachedb = NULL;
	}
	/* init tables' hash table */
	if (!_dbt_cachetbl) {
		_dbt_cachetbl
			= (dbt_tbl_cachel_p)shm_malloc(DBT_CACHETBL_SIZE*
					sizeof(dbt_tbl_cachel_t));
		if(_dbt_cachetbl==NULL)
		{
			LM_CRIT("no enough shm mem\n");
			lock_dealloc(_dbt_cachesem);
			shm_free(_dbt_cachedb);
			return -1;
		}
		memset(_dbt_cachetbl, 0, DBT_CACHETBL_SIZE*sizeof(dbt_tbl_cachel_t));
		for(i=0; i<DBT_CACHETBL_SIZE; i++)
		{
			if (lock_init(&_dbt_cachetbl[i].sem)==0)
			{
				LM_CRIT("cannot init tables' sem's\n");
				for(j=i-1; j>=0; j--)
					lock_destroy(&_dbt_cachetbl[j].sem);
				lock_dealloc(_dbt_cachesem);
				shm_free(_dbt_cachedb);
				return -1;
			}
		}
	}


	return 0;
}
Ejemplo n.º 6
0
void destroy_timer()
{
	struct itimerval it;

	/* disable timer */
	memset(&it, 0, sizeof(it));
	setitimer(ITIMER_REAL, &it, 0);
	set_sig_h(SIGALRM, SIG_IGN);
	if (timer_lock){
		lock_destroy(timer_lock);
		lock_dealloc(timer_lock);
		timer_lock=0;
	}
	if (ticks){
#ifdef SHM_MEM
		shm_free(ticks);
#else
		pkg_free(ticks);
#endif
		ticks=0;
	}
	if (timer_lst){
#ifdef SHM_MEM
		shm_free(timer_lst);
#else
		pkg_free(timer_lst);
#endif
		timer_lst=0;
	}
	if (running_timer){
		shm_free((void*)running_timer);
		running_timer=0;
	}
#ifdef USE_SLOW_TIMER
	if (slow_timer_lock){
		lock_destroy(slow_timer_lock);
		lock_dealloc(slow_timer_lock);
		slow_timer_lock=0;
	}
	if (slow_timer_lists){
		shm_free((void*)slow_timer_lists);
		slow_timer_lists=0;
	}
	if (t_idx){
		shm_free((void*)t_idx);
		t_idx=0;
	}
	if (s_idx){
		shm_free((void*)s_idx);
		s_idx=0;
	}
	if(running_timer2){
		shm_free((void*)running_timer2);
		running_timer2=0;
	}
#endif
}
Ejemplo n.º 7
0
void free_info(cluster_info_t *cl_list)
{
	cluster_info_t *tmp_cl;
	node_info_t *info, *tmp_info;
	struct local_cap *cl_cap, *tmp_cl_cap;
	struct remote_cap *cap, *tmp_cap;

	while (cl_list != NULL) {
		tmp_cl = cl_list;
		cl_list = cl_list->next;

		info = tmp_cl->node_list;
		while (info != NULL) {
			if (info->url.s)
				shm_free(info->url.s);
			if (info->sip_addr.s)
				shm_free(info->sip_addr.s);
			if (info->description.s)
				shm_free(info->description.s);
			if (info->lock) {
				lock_destroy(info->lock);
				lock_dealloc(info->lock);
			}

			cap = info->capabilities;
			while (cap != NULL) {
				tmp_cap = cap;
				cap = cap->next;
				shm_free(tmp_cap);
			}

			tmp_info = info;
			info = info->next;
			shm_free(tmp_info);
		}

		cl_cap = tmp_cl->capabilities;
		while (cl_cap != NULL) {
			tmp_cl_cap = cl_cap;
			cl_cap = cl_cap->next;
			shm_free(tmp_cl_cap);
		}

		if (tmp_cl->lock) {
			lock_destroy(tmp_cl->lock);
			lock_dealloc(tmp_cl->lock);
		}

		shm_free(tmp_cl);
	}
}
Ejemplo n.º 8
0
/* free all resources used by insert buffering */
void destroy_query_list(void)
{
	query_list_t *it;

	for (it=*query_list;it;it=it->next)
	{
		lock_destroy(it->lock);
		lock_dealloc(it->lock);
		shm_free(it);
	}

	lock_destroy(ql_lock);
	lock_dealloc(ql_lock);
}
Ejemplo n.º 9
0
static void destroy(void)
{
	struct secret *secret_struct;

	if (secret_list != NULL)
	{
		SECRET_UNLOCK;
		SECRET_LOCK;
		while (secret_list != NULL)
		{
			secret_struct = secret_list;
			secret_list = secret_struct->next;

			if (secret_struct->secret_key.s != NULL)
			{
				shm_free(secret_struct->secret_key.s);
			}
			shm_free(secret_struct);
		}
		SECRET_UNLOCK;
	}

	if (autheph_secret_lock != NULL)
	{
		lock_destroy(autheph_secret_lock);
		lock_dealloc((void *) autheph_secret_lock);
	}
}
Ejemplo n.º 10
0
    void
sca_hash_table_free( sca_hash_table *ht )
{
    sca_hash_entry	*e, *e_tmp;
    unsigned int	i;

    if ( ht == NULL ) {
	return;
    }

    for ( i = 0; i < ht->size; i++ ) {
	if ( ht->slots[ i ].entries == NULL ) {
	    continue;
	}

	sca_hash_table_lock_index( ht, i );

	for ( e = ht->slots[ i ].entries; e != NULL; e = e_tmp ) {
	    e_tmp = e->next;

	    e->free_entry( e->value );

	    shm_free( e );
	}

	sca_hash_table_unlock_index( ht, i );

	lock_destroy( &ht->slots[ i ].lock );
	lock_dealloc( &ht->slots[ i ].lock );
    }

    shm_free( ht->slots );
    shm_free( ht );
}
Ejemplo n.º 11
0
/**
 * Destroys the worker structures. 
 */
void worker_destroy()
{
	int i;
//	LOG(L_CRIT,"-1-\n");
/*	lock_get(tasks->lock);*/
	for(i=0;i<tasks->max;i++){
		if (tasks->queue[i].msg) AAAFreeMessage(&(tasks->queue[i].msg));
	}
//	LOG(L_CRIT,"-2-\n");	
	shm_free(tasks->queue);
	lock_destroy(tasks->lock);
	lock_dealloc((void*)tasks->lock);
//	LOG(L_CRIT,"-3-\n");	
	
	//lock_release(tasks->empty);
	semctl(tasks->empty, 0, IPC_RMID, cdp_semun_destroy);
//	LOG(L_CRIT,"-4-\n");	
	
	semctl(tasks->full, 0, IPC_RMID, cdp_semun_destroy);
	
	shm_free(tasks);
	
	while(callbacks->head)
		cb_remove(callbacks->head);
	shm_free(callbacks);
}
Ejemplo n.º 12
0
int dbg_init_mypid(void)
{
	if(_dbg_pid_list==NULL)
		return -1;
	if(process_no>=_dbg_pid_no)
		return -1;
	_dbg_pid_list[process_no].pid = (unsigned int)my_pid();
	if(_dbg_breakpoint==1)
		_dbg_pid_list[process_no].set |= DBG_ABKPOINT_ON;
	if(_dbg_cfgtrace==1)
		_dbg_pid_list[process_no].set |= DBG_CFGTRACE_ON;
	if(_dbg_reset_msgid==1)
	{
		LM_DBG("[%d] create locks\n", process_no);
		_dbg_pid_list[process_no].lock = lock_alloc();
		if(_dbg_pid_list[process_no].lock==NULL)
		{
			LM_ERR("cannot allocate the lock\n");
			return -1;
		}
		if(lock_init(_dbg_pid_list[process_no].lock)==NULL)
		{
			LM_ERR("cannot init the lock\n");
			lock_dealloc(_dbg_pid_list[process_no].lock);
			return -1;
		}
	}
	return 0;
}
Ejemplo n.º 13
0
void free_cc_data(struct cc_data *data)
{
	struct cc_flow *flow, *f_flow;
	struct cc_agent *agent,*f_agent;
	int i;

	if (data) {
		/* lock */
		if (data->lock) {
			lock_destroy( data->lock );
			lock_dealloc( data->lock );
		}
		if (data->call_locks) {
			lock_set_destroy( data->call_locks );
			lock_set_dealloc( data->call_locks );
		}
		/* flows */
		for( flow=data->flows ; flow ; ) {
			f_flow = flow;
			flow = flow->next;
			free_cc_flow( f_flow );
		}
		/* agents */
		for(i = 0; i< 2; i++) {
			for( agent=data->agents[i] ; agent ; ) {
				f_agent = agent;
				agent = agent->next;
				free_cc_agent( f_agent );
			}
		}
		shm_free(data);
	}
}
Ejemplo n.º 14
0
void destroy_async_lock(void)
{
	if (xr_lock) {
		lock_destroy(xr_lock);
		lock_dealloc(xr_lock);
	}
}
Ejemplo n.º 15
0
/*
 * destroy function
 */
static void destroy(void)
{
	LM_DBG("start\n");
	
	if(rls_table)
	{
		if(rls_db)
			rlsubs_table_update(0, 0);
		pres_destroy_shtable(rls_table, hash_size);
	}
	if(rls_db && rls_dbf.close)
		rls_dbf.close(rls_db);
	if(rlpres_db && rlpres_dbf.close)
		rlpres_dbf.close(rlpres_db);
	if(rls_xcap_db && rls_xcap_dbf.close)
		rls_xcap_dbf.close(rls_xcap_db);

	if (rls_update_subs_lock != NULL)
	{
		lock_destroy(rls_update_subs_lock);
		lock_dealloc(rls_update_subs_lock);
	}

	if (rls_notifier_id != NULL)
		shm_free(rls_notifier_id);
}
Ejemplo n.º 16
0
void free_lb_data(struct lb_data *data)
{
	struct lb_resource *lbr1, *lbr2;
	struct lb_dst *lbd1, *lbd2;

	if (data==NULL)
		return;

	/* free resources */
	for( lbr1=data->resources ; lbr1 ; ) {
		lbr2 = lbr1;
		lbr1 = lbr1->next;
		if (lbr2->dst_bitmap)
			shm_free(lbr2->dst_bitmap);
		if (lbr2->lock) {
			lock_destroy( lbr2->lock );
			lock_dealloc( lbr2->lock );
		}
		shm_free(lbr2);
	}

	/* free destinations */
	for( lbd1=data->dsts ; lbd1 ; ) {
		lbd2 = lbd1;
		lbd1 = lbd1->next;
		shm_free(lbd2);
	}

	shm_free(data);

	return;
}
Ejemplo n.º 17
0
/*!
 * \brief Initialize the ro_session timer handler
 * Initialize the ro_session timer handler, allocate the lock and a global
 * timer in shared memory. The global timer handler will be set on success.
 * \param hdl ro_session timer handler
 * \return 0 on success, -1 on failure
 */
int init_ro_timer(ro_timer_handler hdl) {
    roi_timer = (struct ro_timer*) shm_malloc(sizeof (struct ro_timer));
    if (roi_timer == 0) {
        LM_ERR("no more shm mem\n");
        return -1;
    }
    memset(roi_timer, 0, sizeof (struct ro_timer));

    roi_timer->first.next = roi_timer->first.prev = &(roi_timer->first);

    roi_timer->lock = lock_alloc();
    if (roi_timer->lock == 0) {
        LM_ERR("failed to alloc lock\n");
        goto error0;
    }

    if (lock_init(roi_timer->lock) == 0) {
        LM_ERR("failed to init lock\n");
        goto error1;
    }

    timer_hdl = hdl;
    return 0;
error1:
    lock_dealloc(roi_timer->lock);
error0:
    shm_free(roi_timer);
    roi_timer = 0;
    return -1;
}
Ejemplo n.º 18
0
static void free_shared_memory(void)
{
	int i;

	if (pcres) {
		for(i=0; i<*num_pcres; i++) {
			if (pcres[i]) {
				shm_free(pcres[i]);
			}
		}
		shm_free(pcres);
	}

	if (num_pcres) {
		shm_free(num_pcres);
	}

	if (pcres_addr) {
		shm_free(pcres_addr);
	}

	if (reload_lock) {
		lock_destroy(reload_lock);
		lock_dealloc(reload_lock);
    }
}
Ejemplo n.º 19
0
void destroy_black_lists(void)
{
	unsigned int i;
	struct bl_rule *p, *q;

	if (no_shm)
		return;

	for(i = 0 ; i < used_heads ; i++){

		if (blst_heads[i].lock) {
			lock_destroy(blst_heads[i].lock);
			lock_dealloc(blst_heads[i].lock);
		}

		for( p=blst_heads[i].first ; p ; ) {
			q = p;
			p = p->next;
			shm_free(q);
		}

		if (blst_heads[i].name.s)
			shm_free(blst_heads[i].name.s);

		blst_heads[i].first = blst_heads[i].last = NULL;
	}

	shm_free(blst_heads);
}
Ejemplo n.º 20
0
void mohq_lock_destroy (mohq_lock *plock)

{
lock_destroy (plock->plock);
lock_dealloc (plock->plock);
return;
}
Ejemplo n.º 21
0
void mod_destroy(void)
{
	unsigned int i;
	if (rl_htable.maps) {
		for (i = 0; i < rl_htable.size; i++)
			map_destroy(rl_htable.maps[i], 0);
		shm_free(rl_htable.maps);
		rl_htable.maps = 0;
		rl_htable.size = 0;
	}
	if (rl_htable.locks) {
		lock_set_destroy(rl_htable.locks);
		lock_set_dealloc(rl_htable.locks);
		rl_htable.locks = 0;
		rl_htable.locks_no = 0;
	}
	if (rl_lock) {
		lock_destroy(rl_lock);
		lock_dealloc(rl_lock);
	}
	RL_SHM_FREE(rl_network_count);
	RL_SHM_FREE(rl_network_load);
	RL_SHM_FREE(rl_load_value);
	RL_SHM_FREE(pid_kp);
	RL_SHM_FREE(pid_ki);
	RL_SHM_FREE(pid_kd);
	RL_SHM_FREE(pid_setpoint);
	RL_SHM_FREE(drop_rate);
	RL_SHM_FREE(rl_feedback_limit);

	if (db_url.s && db_url.len)
		destroy_cachedb();
}
Ejemplo n.º 22
0
void destroy_dispatcher(dispatcher_t* disp)
{
	lock_destroy(disp->lock);
	lock_dealloc(disp->lock);
	sem_destroy(&disp->sem);
	shm_free(disp);
}
Ejemplo n.º 23
0
/* destroys the TCP data */
void tcp_destroy(void)
{
	int part;

	if (tcp_parts[0].tcpconn_id_hash)
			/* force close/expire for all active tcpconns*/
			__tcpconn_lifetime(1);

	if (connection_id){
		shm_free(connection_id);
		connection_id=0;
	}

	for ( part=0 ; part<TCP_PARTITION_SIZE ; part++ ) {
		if (tcp_parts[part].tcpconn_id_hash){
			shm_free(tcp_parts[part].tcpconn_id_hash);
			tcp_parts[part].tcpconn_id_hash=0;
		}
		if (tcp_parts[part].tcpconn_aliases_hash){
			shm_free(tcp_parts[part].tcpconn_aliases_hash);
			tcp_parts[part].tcpconn_aliases_hash=0;
		}
		if (tcp_parts[part].tcpconn_lock){
			lock_destroy(tcp_parts[part].tcpconn_lock);
			lock_dealloc((void*)tcp_parts[part].tcpconn_lock);
			tcp_parts[part].tcpconn_lock=0;
		}
	}
}
Ejemplo n.º 24
0
int init_dlg_ping_timer(void)
{
	ping_timer = (struct dlg_ping_timer*)shm_malloc(sizeof(struct dlg_timer));
	if (ping_timer==0) {
		LM_ERR("no more shm mem\n");
		return -1;
	}

	memset(ping_timer,0,sizeof(struct dlg_ping_timer));
	ping_timer->lock = lock_alloc();
	if (ping_timer->lock == 0) {
		LM_ERR("failed to alloc lock\n");
		goto error0;
	}

	if (lock_init(ping_timer->lock) == 0) {
		LM_ERR("failed to init lock\n");
		goto error1;
	}

	return 0;

error1:
	lock_dealloc(ping_timer->lock);
error0:
	shm_free(ping_timer);
	ping_timer=0;
	return -1;
}
Ejemplo n.º 25
0
void free_saved_transaction_global_data(saved_transaction_t* data) {
    if (!data)
        return;

    lock_dealloc(data->lock);
    lock_destroy(data->lock);
    shm_free(data);
}
Ejemplo n.º 26
0
static void destroy_shmlock(void)
{
	if (lock) {
		lock_destroy(lock);
		lock_dealloc((void *)lock);
		lock = NULL;
	}
}
Ejemplo n.º 27
0
static void destroy_shmlock(void)
{
	if (conf_lock) {
		lock_destroy(conf_lock);
		lock_dealloc((void *)conf_lock);
		conf_lock = NULL;
	}
}
Ejemplo n.º 28
0
void destroy_kill()
{
	/* if disabled ... */
	if (time_to_kill==0) 
		return; 
	lock_destroy(kill_lock);
	lock_dealloc(kill_lock);
	return;
}
Ejemplo n.º 29
0
/**
 * Destroys the session related structures.
 */
int session_destroy()
{
	lock_get(session_lock);
	lock_destroy(session_lock);
	lock_dealloc((void*)session_lock);	
	shm_free(session_id1);
	shm_free(session_id2);
	return 1;
}
Ejemplo n.º 30
0
void wsconn_destroy(void)
{
	int h;

	if (wsconn_used_list)
	{
		shm_free(wsconn_used_list);
		wsconn_used_list = NULL;
	}

	if (wsconn_id_hash)
	{
		WSCONN_UNLOCK;
		WSCONN_LOCK;
		for (h = 0; h < TCP_ID_HASH_SIZE; h++)
		{
			ws_connection_t *wsc = wsconn_id_hash[h];
			while (wsc)
			{
				ws_connection_t *next = wsc->id_next;
				_wsconn_rm(wsc);
				wsc = next;
			}
		}
		WSCONN_UNLOCK;

		shm_free(wsconn_id_hash);
		wsconn_id_hash = NULL;
	}

	if (wsconn_lock)
	{
		lock_destroy(wsconn_lock);
		lock_dealloc((void *) wsconn_lock);
		wsconn_lock = NULL;
	}

	if (wsstat_lock)
	{
		lock_destroy(wsstat_lock);
		lock_dealloc((void *) wsstat_lock);
		wsstat_lock = NULL;
	}
}