Module: sip-router
Branch: master
Commit: 54b44414fff9eb94cad752f93d54005eea8c0c85
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=54b4441…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Tue Mar 6 18:04:20 2012 +0000
modules_k/presence: Some important stuff was removed when the latest set of presence fixes were merged in
- The result was that PUA and RLS in master would not longer compile
- I have restored the stuff needed to build PUA and RLS, but there
could well be other stuff that has been lost
---
modules_k/presence/subscribe.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/modules_k/presence/subscribe.h b/modules_k/presence/subscribe.h
index 05a8fa5..bf7d189 100644
--- a/modules_k/presence/subscribe.h
+++ b/modules_k/presence/subscribe.h
@@ -52,6 +52,9 @@ struct pres_ev;
#define PRES_SUBSCRIBE_RECV 1
+#define INTERNAL_UPDATE_FALSE 0
+#define INTERNAL_UPDATE_TRUE 1
+
struct subscription
{
str pres_uri;
@@ -78,6 +81,7 @@ struct subscription
int db_flag;
str* auth_rules_doc;
int recv_event;
+ int internal_update_flag;
struct subscription* next;
};
Module: sip-router
Branch: master
Commit: d8fe0def83736c204dd1eace89e8ca1823704fc3
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d8fe0de…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri Mar 9 19:12:59 2012 +0100
dns: srv load balancing distribution fix
The load distribution when doing SRV based load balancing was not
completely fair. The first listed server had always an extra
(sum_of_weights-weight)/(sum_of_weights*(sum_of_weights+1) chance
of being selected.
For example for 2 servers both with weight 50, the first one
will have an extra (100-50)/100*101 change of being selected =>
extra 0.495% which gives a 50.495% - 49.505% distribution
instead of 50% - 50%. For large weight values this doesn't make a big
difference (e.g. for 500-500 => 50.049% instead of 50%) but for
small values it becomes very noticeable (e.g. for 1-1 =>
66% - 33% distribution instead of 50%-50%).
The chance of selecting a 0-weight record was also changed. It was
1/(sum_of_weights+1) and now is 1/(sum_of_weights*1000).
Reported-by: Michal Matyska michal.matyska iptel org
---
dns_cache.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/dns_cache.c b/dns_cache.c
index da8f97d..1a7f1c5 100644
--- a/dns_cache.c
+++ b/dns_cache.c
@@ -100,6 +100,8 @@
#define DNS_HE_MAX_ADDR 10 /* maxium addresses returne in a hostent struct */
#define MAX_CNAME_CHAIN 10
#define SPACE_FORMAT " " /* format of view output */
+#define DNS_SRV_ZERO_W_CHANCE 1000 /* one in a 1000*weight_sum chance for
+ selecting a 0-weight record */
int dns_cache_init=1; /* if 0, the DNS cache is not initialized at startup */
static gen_lock_t* dns_hash_lock=0;
@@ -2286,6 +2288,7 @@ inline static struct dns_rr* dns_srv_get_nxt_rr(struct dns_hash_entry* e,
unsigned rand_w;
int found;
int saved_idx;
+ int zero_weight; /* number of records with 0 weight */
int i, idx;
struct r_sums_entry{
unsigned r_sum;
@@ -2307,6 +2310,7 @@ retry:
prio=((struct srv_rdata*)start_grp->rdata)->priority;
sum=0;
saved_idx=-1;
+ zero_weight = 0;
found=0;
for (idx=0;rr && (prio==((struct srv_rdata*)rr->rdata)->priority) &&
(idx < MAX_SRV_GRP_IDX); idx++, rr=rr->next){
@@ -2328,6 +2332,7 @@ retry:
if ((saved_idx==-1) || (((struct srv_rdata*)rr->rdata)->weight==0)){
saved_idx=idx;
}
+ zero_weight += (((struct srv_rdata*)rr->rdata)->weight == 0);
sum+=((struct srv_rdata*)rr->rdata)->weight;
r_sums[idx].r_sum=sum;
r_sums[idx].rr=rr;
@@ -2338,10 +2343,15 @@ retry:
n+=idx; /* next group start idx, last rr */
srv_reset_tried(tried);
goto retry;
- }else if ((found==1) || ((rand_w=dns_srv_random(sum))==0)){
- /* 1. if only one found, avoid a useless random() call or
- * 2. if rand_w==0, immediately select a 0 weight record if present,
- * or else the first record found
+ }else if ((found==1) || (sum==0) ||
+ (((rand_w=(dns_srv_random(sum-1)+1))==1) && zero_weight &&
+ (dns_srv_random(DNS_SRV_ZERO_W_CHANCE)==0))){
+ /* 1. if only one found, avoid a useless random() call
+ and select it (saved_idx will point to it).
+ * 2. if the sum of weights is 0 (all have 0 weight) or
+ * 3. rand_w==1 and there are records with 0 weight and
+ * random(probab. of selecting a 0-weight)
+ * immediately select a 0 weight record.
* (this takes care of the 0-weight at the beginning requirement) */
i=saved_idx; /* saved idx contains either first 0 weight or first
valid record */
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#89 - tls module 'config' param can point to directory
User who did this - Daniel-Constantin Mierla (miconda)
----------
Looks interesting, you can go ahead and commit if nobody else has other suggestions for such feature.
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=89#comment509
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
Module: sip-router
Branch: master
Commit: 46eb7f2c33231355aa26632bc3d1adb02ee2556f
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=46eb7f2…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Mon Mar 12 21:44:46 2012 +0000
modules_k/rls: Fixed race hazard on rls_presentity table
- During testing I observed that it is possible for two back-end NOTIFYs that
will affect the same rls_presentity table row to be processed simultaneously.
This is a problem when the row does not yet exist as the SELECTs can both
return 0 rows resulting in both processes trying to INSERT - but only one
will succeed.
- The easiest way to fix this is to use the replace() DB API, but this is not
available for some databases (for example, PostgreSQL).
- I have updated the code to use replace() when it is available and to do an
update() then check affected_rows() (and if 0 then do an insert()) when
replace() is not available.
- The update() and then insert() process makes the window for the race much
smaller, but doesn't get rid of it completely. However, with PostgreSQL a
DB rule can be used to fix it completely.
- PostgreSQL DB rule:
CREATE RULE "rls_presentity_insert_race" AS ON INSERT TO "rls_presentity"
WHERE EXISTS(
SELECT 1 FROM rls_presentity WHERE (rlsubs_did, resource_uri)=(NEW.rlsubs_did, NEW.resource_uri)
) DO INSTEAD (
UPDATE rls_presentity
SET updated=NEW.updated,
auth_state=NEW.auth_state,
reason=NEW.reason,
content_type=NEW.content_type,
presence_state=NEW.presence_state,
expires=NEW.expires
WHERE (rlsubs_did, resource_uri)=(NEW.rlsubs_did, NEW.resource_uri)
);
---
modules_k/rls/resource_notify.c | 45 ++++++++++++++++----------------------
1 files changed, 19 insertions(+), 26 deletions(-)
diff --git a/modules_k/rls/resource_notify.c b/modules_k/rls/resource_notify.c
index df40e82..d0bf435 100644
--- a/modules_k/rls/resource_notify.c
+++ b/modules_k/rls/resource_notify.c
@@ -500,16 +500,15 @@ int rls_handle_notify(struct sip_msg* msg, char* c1, char* c2)
str body= {0, 0};
ua_pres_t dialog;
str* res_id= NULL;
- db_key_t query_cols[9], result_cols[1];
- db_val_t query_vals[9];
- db1_res_t* result= NULL;
+ db_key_t query_cols[8];
+ db_val_t query_vals[8];
int n_query_cols= 0;
str auth_state= {0, 0};
int found= 0;
str reason = {0, 0};
int auth_flag;
struct hdr_field* hdr= NULL;
- int n, expires= -1;
+ int expires= -1;
str content_type= {0, 0};
int reply_code = 500;
str reply_str = pu_500_rpl;
@@ -755,42 +754,36 @@ int rls_handle_notify(struct sip_msg* msg, char* c1, char* c2)
LM_ERR("in use_table\n");
goto error;
}
- /* query-> if not present insert // else update */
- result_cols[0]= &str_updated_col;
-
- if(rlpres_dbf.query(rlpres_db, query_cols, 0, query_vals, result_cols,
- 2, 1, 0, &result)< 0)
- {
- LM_ERR("in sql query\n");
- if(result)
- rlpres_dbf.free_result(rlpres_db, result);
- goto error;
- }
- if(result== NULL)
- goto error;
- n= result->n;
- rlpres_dbf.free_result(rlpres_db, result);
-
- if(n<= 0)
+
+ if (rlpres_dbf.replace != NULL)
{
- if(rlpres_dbf.insert(rlpres_db, query_cols, query_vals, n_query_cols)< 0)
+ if(rlpres_dbf.replace(rlpres_db, query_cols, query_vals, n_query_cols)< 0)
{
- LM_ERR("in sql insert\n");
+ LM_ERR("in sql replace\n");
goto error;
}
- LM_DBG("Inserted in database table new record\n");
+ LM_DBG("Inserted/replace in database table new record\n");
}
else
{
- LM_DBG("Updated in db table already existing record\n");
if(rlpres_dbf.update(rlpres_db, query_cols, 0, query_vals, query_cols+2,
query_vals+2, 2, n_query_cols-2)< 0)
{
LM_ERR("in sql update\n");
goto error;
}
- }
+ if (rlpres_dbf.affected_rows(rlpres_db) == 0)
+ {
+ if(rlpres_dbf.insert(rlpres_db, query_cols, query_vals, n_query_cols)< 0)
+ {
+ LM_ERR("in sql insert\n");
+ goto error;
+ }
+ LM_DBG("Inserted in database table new record\n");
+ }
+ }
+
LM_DBG("Updated rlpres_table\n");
/* reply 200OK */
done:
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task is now closed:
FS#40 - Kamailio 1.5 Dispatcher (minor) problem.
User who did this - Daniel-Constantin Mierla (miconda)
Reason for closing: Deferred
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=40
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#40 - Kamailio 1.5 Dispatcher (minor) problem.
User who did this - Daniel-Constantin Mierla (miconda)
----------
This got a bit old, thinking of it is for 1.5 and has an workaround, I am closing it -- it would be hard for a devel to test it with that version. If you can reproduce it with latest version, reopen and paste the log messages with debug=3. I suspect the keepalives are sent from an interface that has no route, which might be just fixed by setting mhomed parameter.
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=40#comment508
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task is now closed:
FS#12 - check symbol conflicts
User who did this - Daniel-Constantin Mierla (miconda)
Reason for closing: Not a bug
Additional comments about closing: Mac os x goes smooth.
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=12
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.