소스 검색

modules/p_usrloc Fixed mode WRITE_THROUGH (and WRITE_BACK) (crash)

TODO: list of domains is kept in private mem, not shared. (!)
Marius Zbihlei 14 년 전
부모
커밋
df21482454
3개의 변경된 파일14개의 추가작업 그리고 3개의 파일을 삭제
  1. 13 1
      modules_k/p_usrloc/dlist.c
  2. 0 1
      modules_k/p_usrloc/ucontact.c
  3. 1 1
      modules_k/p_usrloc/ul_db_layer.c

+ 13 - 1
modules_k/p_usrloc/dlist.c

@@ -71,7 +71,7 @@ static inline struct domain_list_item * find_dlist (str *name) {
 
 
 static inline struct domain_list_item * add_to_dlist (str *name, int type) {
 static inline struct domain_list_item * add_to_dlist (str *name, int type) {
 	struct domain_list_item *item;
 	struct domain_list_item *item;
-
+        int i;
 	item = (struct domain_list_item *)
 	item = (struct domain_list_item *)
 	       pkg_malloc (sizeof (struct domain_list_item));
 	       pkg_malloc (sizeof (struct domain_list_item));
 	if (item == NULL) {
 	if (item == NULL) {
@@ -90,6 +90,18 @@ static inline struct domain_list_item * add_to_dlist (str *name, int type) {
 	memset (&item->domain, 0, sizeof (struct udomain));
 	memset (&item->domain, 0, sizeof (struct udomain));
 	item->domain.name = &item->name;
 	item->domain.name = &item->name;
 	item->domain.dbt = type;
 	item->domain.dbt = type;
+
+	item->domain.table = (hslot_t*)pkg_malloc(sizeof(hslot_t) * ul_hash_size);
+	if (!item->domain.table) {
+		LM_ERR("no memory left 2\n");
+		return NULL;
+	}
+
+	for(i = 0; i < ul_hash_size; i++) {
+		init_slot(&item->domain, &(item->domain.table[i]), i);
+	}
+
+	item->domain.size = ul_hash_size;
 	/* Everything else is not useful for now.  */
 	/* Everything else is not useful for now.  */
 
 
 	item->next = domain_list;
 	item->next = domain_list;

+ 0 - 1
modules_k/p_usrloc/ucontact.c

@@ -399,7 +399,6 @@ int db_insert_ucontact(ucontact_t* _c)
 	if(register_udomain(_c->domain->s, &_d) < 0){
 	if(register_udomain(_c->domain->s, &_d) < 0){
 		return -1;
 		return -1;
 	}
 	}
-
 	keys[0] = &user_col;
 	keys[0] = &user_col;
 	keys[1] = &contact_col;
 	keys[1] = &contact_col;
 	keys[2] = &expires_col;
 	keys[2] = &expires_col;

+ 1 - 1
modules_k/p_usrloc/ul_db_layer.c

@@ -213,7 +213,7 @@ int ul_db_layer_free_result(udomain_t * domain, db1_res_t * res) {
 
 
 int ul_add_domain_db(str * d, int t, str * url) {
 int ul_add_domain_db(str * d, int t, str * url) {
 	ul_domain_db_list_t * new_d = NULL;
 	ul_domain_db_list_t * new_d = NULL;
-	LM_DBG("%.*s, type: %s\n", d->len, d->s,
+	LM_ERR("%.*s, type: %s\n", d->len, d->s,
 			t==DB_TYPE_SINGLE ? "SINGLE" : "CLUSTER");
 			t==DB_TYPE_SINGLE ? "SINGLE" : "CLUSTER");
 	if((new_d = pkg_malloc(sizeof(ul_domain_db_list_t))) == NULL) {
 	if((new_d = pkg_malloc(sizeof(ul_domain_db_list_t))) == NULL) {
 		return -1;
 		return -1;