Beispiel #1
0
static lnodeptr  hash_find_node(hash_table *table,uint64_t key){
	linklist *l = get_linklist(table,key);
	hash_node *hnode =NULL;
	lnodeptr node = linklist_first(l);
	while(node){
		hnode = (hash_node *)node->data;
		if(hnode->key == key){
			hnode->access_time = time(NULL);
			/* put the lastest item to the head of the link list */
			(void)linklist_remove(node);
			linklist_push(l,node);
			return node;
		}
		node = linklist_get_next(l,node);
	}
	return NULL;
}
Beispiel #2
0
/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  delay_table_destroy
 *  Description:  destroy delay table
 * =====================================================================================
 */
void delay_table_destroy()
{
	uint32_t i=0;
	linklist* list=NULL;
	linklist *msg_list=NULL;
	lnodeptr node=NULL;
	hash_node *hnode=NULL;

	if(table!=NULL)
	{
		logInfo(LOG_NOTICE,"destroy delayed table");
		for(;i<table->size;i++)
		{
			list=table->lists[i];
			node = linklist_first(list);
			while(node){
				hnode = (hash_node *)node->data;
				if(hnode->data!=NULL)
				{
					msg_list=(linklist *)hnode->data;
					count+=linklist_destory(msg_list);
					free(msg_list);
					lDestroy++;
				}	
				hnode->data=NULL;
				node = linklist_get_next(list,node);
			}
		}

		logInfo(LOG_NOTICE,"destroy msg list items:%d,free:%d,total:%d",
				count,fCount,mCount);
		logInfo(LOG_NOTICE,"create msg list:%d,delayDel:%d,destroyList:%d",
				lCount,delayDel,lDestroy);
		hash_destory(table);
		free(table);
		table=NULL;
	}
}