Module: kamailio
Branch: master
Commit: 99caa6c583c68f61aded4988e8a1603e78015a0a
URL: https://github.com/kamailio/kamailio/commit/99caa6c583c68f61aded4988e8a1603…
Author: jaybeepee <jason.penton(a)gmail.com>
Committer: jaybeepee <jason.penton(a)gmail.com>
Date: 2016-03-17T09:53:39+02:00
modules/ims_registrar_scscf: more efficient traversal of contacts
---
Modified: modules/ims_registrar_scscf/save.c
---
Diff: https://github.com/kamailio/kamailio/commit/99caa6c583c68f61aded4988e8a1603…
Patch: https://github.com/kamailio/kamailio/commit/99caa6c583c68f61aded4988e8a1603…
---
diff --git a/modules/ims_registrar_scscf/save.c b/modules/ims_registrar_scscf/save.c
index d677272..41fe9f6 100644
--- a/modules/ims_registrar_scscf/save.c
+++ b/modules/ims_registrar_scscf/save.c
@@ -694,8 +694,12 @@ int get_number_of_valid_contacts(impurecord_t* impu) {
int ret = 0;
get_act_time();
for (i = 0; i < impu->num_contacts; i++) {
- if (VALID_CONTACT(impu->newcontacts[i], act_time)) {
- ret++;
+ if (impu->newcontacts[i]) {
+ if VALID_CONTACT(impu->newcontacts[i], act_time)
+ ret++;
+ } else {
+ //if we hit a null ref then we are at the end of the list.
+ return ret;
}
}
Module: kamailio
Branch: master
Commit: 82c42dd91c5f715a17fca767ade700afde29c7a5
URL: https://github.com/kamailio/kamailio/commit/82c42dd91c5f715a17fca767ade700a…
Author: jaybeepee <jason.penton(a)gmail.com>
Committer: jaybeepee <jason.penton(a)gmail.com>
Date: 2016-03-17T09:51:42+02:00
modules/ims_registrar_scscf: protection around sending notifications - prevent races
---
Modified: modules/ims_registrar_scscf/save.c
---
Diff: https://github.com/kamailio/kamailio/commit/82c42dd91c5f715a17fca767ade700a…
Patch: https://github.com/kamailio/kamailio/commit/82c42dd91c5f715a17fca767ade700a…
---
diff --git a/modules/ims_registrar_scscf/save.c b/modules/ims_registrar_scscf/save.c
index a33dbcf..d677272 100644
--- a/modules/ims_registrar_scscf/save.c
+++ b/modules/ims_registrar_scscf/save.c
@@ -859,11 +859,14 @@ int update_contacts(struct sip_msg* msg, udomain_t* _d,
LM_DBG("ref count after sub is now %d\n", subscription->ref_count);
ul.unlock_subscription(subscription);
+ ul.lock_udomain(_d, public_identity);
//finally we update the explicit IMPU record with the new data
if (ul.update_impurecord(_d, public_identity, 0, reg_state, -1 /*do not change send sar on delete */, 0 /*this is explicit so barring must be 0*/, 0, s, ccf1, ccf2, ecf1, ecf2, &impu_rec) != 0) {
LM_ERR("Unable to update explicit impurecord for <%.*s>\n", public_identity->len, public_identity->s);
}
+
notify_subscribers(impu_rec);
+ ul.unlock_udomain(_d, public_identity);
break;
case AVP_IMS_SAR_USER_DEREGISTRATION:
/*TODO: if its not a star lets find all the contact records and remove them*/
tps_msg.c: In function "tps_pack_request":
tps_msg.c:384:5: warning: implicit declaration of function "strnstr"
[-Wimplicit-function-declaration]
if(strnstr(ptsd->bs_contact.s, ";r2=on",
^
strnstr is not available on linux.
A local implementation exists in tm/t_msgbuilder.c: _strnstr
Another one in sdpops/sdpops_mod.c: strnistr
Probably there should be one single implementation in core available
for all modules.
-ovidiu
--
VoIP Embedded, Inc.
http://www.voipembedded.com