Module: sip-router
Branch: mariuszbihlei/p_usrloc
Commit: 0cc01cc1b0b9a19072b97e874e4ad7007e43d3d3
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0cc01cc…
Author: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei(a)1and1.ro>
Date: Tue Jan 18 17:09:06 2011 +0200
modules/p_usrloc Fixed mode WRITE_THROUGH (and WRITE_BACK) (crash)
TODO: list of domains is kept in private mem, not shared. (!)
---
modules_k/p_usrloc/dlist.c | 14 +++++++++++++-
modules_k/p_usrloc/ucontact.c | 1 -
modules_k/p_usrloc/ul_db_layer.c | 2 +-
3 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/modules_k/p_usrloc/dlist.c b/modules_k/p_usrloc/dlist.c
index 23b9c50..a2687b2 100644
--- a/modules_k/p_usrloc/dlist.c
+++ b/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) {
struct domain_list_item *item;
-
+ int i;
item = (struct domain_list_item *)
pkg_malloc (sizeof (struct domain_list_item));
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));
item->domain.name = &item->name;
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. */
item->next = domain_list;
diff --git a/modules_k/p_usrloc/ucontact.c b/modules_k/p_usrloc/ucontact.c
index 859408f..b97f0f1 100644
--- a/modules_k/p_usrloc/ucontact.c
+++ b/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){
return -1;
}
-
keys[0] = &user_col;
keys[1] = &contact_col;
keys[2] = &expires_col;
diff --git a/modules_k/p_usrloc/ul_db_layer.c b/modules_k/p_usrloc/ul_db_layer.c
index 2731201..474db5d 100644
--- a/modules_k/p_usrloc/ul_db_layer.c
+++ b/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) {
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");
if((new_d = pkg_malloc(sizeof(ul_domain_db_list_t))) == NULL) {
return -1;