Hello Daniel,
Thank you for the advice. I didn't notice the htable changes on the master branch.
Regards,
Marius
________________________________
From: Daniel-Constantin Mierla <miconda(a)gmail.com>
To: Development mailing list of the sip-router project
<sr-dev(a)lists.sip-router.org>
Cc: Marius Ovidiu Bucur <marius(a)marius-bucur.ro>
Sent: Saturday, June 4, 2011 12:53 AM
Subject: Re: [sr-dev] git:mariusbucur/dmq: modified the htable so that a per-table basis
dmq parameter can be added
Hi Marius,
seems you work on an old version of htable module -- probably you
haven't sync'ed your branch with the master for a while.
For example the function ht_pkg_init() no longer exists. You should sync
your branch to master, otherwise you are going to work twice for some parts.
Cheers,
Daniel
On 6/3/11 11:48 PM, Marius Ovidiu Bucur wrote:
Module: sip-router
Branch: mariusbucur/dmq
Commit: 7ff94993efc1d34bbd78498a27b9de84bc8f41b8
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7ff9499…
Author: Marius Bucur<marius(a)marius-bucur.ro>
Committer: Marius Bucur<marius(a)marius-bucur.ro>
Date: Sat Jun 4 00:47:44 2011 +0300
modified the htable so that a per-table basis dmq parameter can be added
---
modules_k/htable/ht_api.c | 15 ++++++++++++---
modules_k/htable/ht_api.h | 3 ++-
modules_k/htable/ht_var.c | 2 +-
modules_k/htable/htable.c | 18 +++++++-----------
4 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/modules_k/htable/ht_api.c b/modules_k/htable/ht_api.c
index fe9a66e..b221ea5 100644
--- a/modules_k/htable/ht_api.c
+++ b/modules_k/htable/ht_api.c
@@ -117,7 +117,7 @@ ht_t* ht_get_table(str *name)
return NULL;
}
-int ht_pkg_init(str *name, int autoexp, str *dbtable, int size, int dbmode)
+int ht_pkg_init(str *name, int autoexp, str *dbtable, int size, int dbmode, int usedmq)
{
unsigned int htid;
ht_t *ht;
@@ -156,7 +156,7 @@ int ht_pkg_init(str *name, int autoexp, str *dbtable, int size, int
dbmode)
if(dbtable!=NULL&& dbtable->len>0)
ht->dbtable = *dbtable;
ht->dbmode = dbmode;
-
+ ht->usedmq = usedmq;
ht->next = _ht_pkg_root;
_ht_pkg_root = ht;
return 0;
@@ -515,6 +515,7 @@ int ht_table_spec(char *spec)
str name;
str dbtable = {0, 0};
unsigned int autoexpire = 0;
+ unsigned int usedmq = 0;
unsigned int size = 4;
int type = 0;
unsigned int dbmode = 0;
@@ -574,6 +575,8 @@ next_token:
type = 3;
else if(tok.len==6&& strncmp(tok.s, "dbmode", 6)==0)
type = 4;
+ else if(tok.len==3&& strncmp(tok.s, "dmq", 3)==0)
+ type = 5;
else goto error;
if(*p!='=')
@@ -623,6 +626,12 @@ next_token:
LM_DBG("htable [%.*s] - dbmode [%u]\n", name.len, name.s,
dbmode);
break;
+ case 5:
+ if(str2int(&tok,&usedmq)!=0)
+ goto error;
+ LM_DBG("htable [%.*s] - usedmq [%u]\n", name.len, name.s,
+ usedmq);
+ break;
}
while(p<in.s+in.len&& (*p==';' || *p==' ' ||
*p=='\t'
|| *p=='\n' || *p=='\r'))
@@ -630,7 +639,7 @@ next_token:
if(p<in.s+in.len)
goto next_token;
- return ht_pkg_init(&name, autoexpire,&dbtable, size, dbmode);
+ return ht_pkg_init(&name, autoexpire,&dbtable, size, dbmode, usedmq);
error:
LM_ERR("invalid htable parameter [%.*s] at [%d]\n", in.len, in.s,
diff --git a/modules_k/htable/ht_api.h b/modules_k/htable/ht_api.h
index 71c8e21..8dc7553 100644
--- a/modules_k/htable/ht_api.h
+++ b/modules_k/htable/ht_api.h
@@ -55,6 +55,7 @@ typedef struct _ht
unsigned int htexpire;
str dbtable;
int dbmode;
+ int usedmq;
unsigned int htsize;
ht_entry_t *entries;
struct _ht *next;
@@ -66,7 +67,7 @@ typedef struct _ht_pv {
pv_elem_t *pve;
} ht_pv_t, *ht_pv_p;
-int ht_pkg_init(str *name, int autoexp, str *dbtable, int size, int dbmode);
+int ht_pkg_init(str *name, int autoexp, str *dbtable, int size, int dbmode, int
usedmq);
int ht_shm_init(void);
int ht_destroy(void);
int ht_set_cell(ht_t *ht, str *name, int type, int_str *val, int mode);
diff --git a/modules_k/htable/ht_var.c b/modules_k/htable/ht_var.c
index 921cca3..26e0747 100644
--- a/modules_k/htable/ht_var.c
+++ b/modules_k/htable/ht_var.c
@@ -109,7 +109,7 @@ int pv_set_ht_cell(struct sip_msg* msg, pv_param_t *param,
LM_ERR("cannot get $ht name\n");
return -1;
}
- if(ht_use_dmq) {
+ if(hpv->ht->usedmq) {
serialized_ht.s = pkg_malloc(MAX_HT_SERIALIZE_BUF);
serialized_ht.len = MAX_HT_SERIALIZE_BUF;
if(serialize_ht_pair(&htname,
val,&hpv->htname,&serialized_ht)< 0) {
diff --git a/modules_k/htable/htable.c b/modules_k/htable/htable.c
index 58a690c..62ca74d 100644
--- a/modules_k/htable/htable.c
+++ b/modules_k/htable/htable.c
@@ -101,7 +101,7 @@ error:
return -1;
}
-static void add_dmq_peer() {
+static void ht_add_dmq_peer() {
dmq_peer_t htable_peer;
memset(&ht_dmq_resp_cback, 0, sizeof(ht_dmq_resp_cback));
htable_peer.peer_id.s = "htable";
@@ -113,7 +113,6 @@ static void add_dmq_peer() {
}
int ht_timer_interval = 20;
-int ht_use_dmq = 0;
static int htable_init_rpc(void);
@@ -174,7 +173,6 @@ static param_export_t params[]={
{"array_size_suffix", STR_PARAM,&ht_array_size_suffix.s},
{"fetch_rows", INT_PARAM,&ht_fetch_rows},
{"timer_interval", INT_PARAM,&ht_timer_interval},
- {"use_dmq", INT_PARAM,&ht_use_dmq},
{0,0,0}
};
@@ -240,14 +238,12 @@ static int mod_init(void)
}
}
- if(ht_use_dmq){
- if(dmq_load_api(&ht_dmq_bind)< 0) {
- LM_ERR("cannot load dmq api\n");
- return -1;
- } else {
- add_dmq_peer();
- LM_DBG("presence-dmq loaded\n");
- }
+ if(dmq_load_api(&ht_dmq_bind)< 0) {
+ LM_ERR("cannot load dmq api\n");
+ return -1;
+ } else {
+ ht_add_dmq_peer();
+ LM_DBG("presence-dmq loaded\n");
}
return 0;
}
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
_______________________________________________
sr-dev mailing list
sr-dev(a)lists.sip-router.org