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