Beispiel #1
0
int insert_shtable(sbtable_t htable, unsigned int hash_code, struct sm_subscriber* subs){
	struct sm_subscriber* new_rec= NULL;

	new_rec= mem_copy_subs_noc(subs);
	if(new_rec== NULL){
		LM_ERR("copying in share memory a sm_subscriber structure\n");
		goto error;
	}

	lock_get(&htable[hash_code].lock);

	new_rec->next= htable[hash_code].entries->next;

	htable[hash_code].entries->next= new_rec;

	LM_DBG("******************************END ENTRADA DO HASH %p\n",(void*)new_rec);

	lock_release(&htable[hash_code].lock);

	return 0;

error:
	if(new_rec)
		shm_free(new_rec);
	return -1;
}
Beispiel #2
0
int insert_shtable(shtable_t htable,unsigned int hash_code, subs_t* subs)
{
	subs_t* new_rec= NULL;

	new_rec= mem_copy_subs_noc(subs);
	if(new_rec== NULL)
	{
		LM_ERR("copying in share memory a subs_t structure\n");
		goto error;
	}

	new_rec->expires+= (int)time(NULL);
	if(fallback2db)
		new_rec->db_flag= NO_UPDATEDB_FLAG;
	else
		new_rec->db_flag= INSERTDB_FLAG;

	lock_get(&htable[hash_code].lock);
	
	new_rec->next= htable[hash_code].entries->next;
	
	htable[hash_code].entries->next= new_rec;
	
	lock_release(&htable[hash_code].lock);
	
	return 0;

error:
	if(new_rec)
		shm_free(new_rec);
	return -1;
}
Beispiel #3
0
struct sm_subscriber* insert_shtable(sbtable_t htable, unsigned int hash_code, struct sm_subscriber* subs){
	struct sm_subscriber* new_rec= NULL;

	new_rec= mem_copy_subs_noc(subs);
	if(new_rec== NULL){
		LM_ERR("copying in share memory a sm_subscriber structure\n");
		return NULL;
	}

	lock_get(&htable[hash_code].lock);

	new_rec->next= htable[hash_code].entries->next;
	htable[hash_code].entries->next= new_rec;

	lock_release(&htable[hash_code].lock);

	return new_rec;
}
Beispiel #4
0
int insert_shtable(shtable_t htable,unsigned int hash_code, subs_t* subs)
{
	subs_t* new_rec= NULL;

	new_rec= mem_copy_subs_noc(subs);
	if(new_rec== NULL)
	{
		LM_ERR("copying in share memory a subs_t structure\n");
		return -1;
	}
	new_rec->expires+= (int)time(NULL);

	lock_get(&htable[hash_code].lock);
	new_rec->next= htable[hash_code].entries->next;
	htable[hash_code].entries->next= new_rec;
	lock_release(&htable[hash_code].lock);

	return 0;
}