Module: kamailio
Branch: master
Commit: 497777e042166e441767101db05c85ad69c13722
URL:
https://github.com/kamailio/kamailio/commit/497777e042166e441767101db05c85a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-01-02T13:41:44+01:00
presence: more verbose debug message when failing to delete item from memory
- re-ordered comparison expression to check first lengths
---
Modified: modules/presence/hash.c
Modified: modules/presence/subscribe.c
---
Diff:
https://github.com/kamailio/kamailio/commit/497777e042166e441767101db05c85a…
Patch:
https://github.com/kamailio/kamailio/commit/497777e042166e441767101db05c85a…
---
diff --git a/modules/presence/hash.c b/modules/presence/hash.c
index ed1a188..4c6f181 100644
--- a/modules/presence/hash.c
+++ b/modules/presence/hash.c
@@ -287,12 +287,12 @@ int delete_shtable(shtable_t htable,unsigned int hash_code,subs_t*
subs)
while(s)
{
- if(s->callid.len==subs->callid.len &&
- strncmp(s->callid.s, subs->callid.s, subs->callid.len)==0 &&
- s->to_tag.len== subs->to_tag.len &&
- strncmp(s->to_tag.s, subs->to_tag.s, subs->to_tag.len)==0 &&
- s->from_tag.len== subs->from_tag.len &&
- strncmp(s->from_tag.s, subs->from_tag.s, subs->from_tag.len)== 0)
+ if(s->callid.len==subs->callid.len
+ && s->to_tag.len==subs->to_tag.len
+ && s->from_tag.len==subs->from_tag.len
+ && strncmp(s->callid.s,subs->callid.s,subs->callid.len)==0
+ && strncmp(s->to_tag.s,subs->to_tag.s,subs->to_tag.len)==0
+ && strncmp(s->from_tag.s,subs->from_tag.s,subs->from_tag.len)==0)
{
found= s->local_cseq +1;
ps->next= s->next;
diff --git a/modules/presence/subscribe.c b/modules/presence/subscribe.c
index 9c9b9ac..172372d 100644
--- a/modules/presence/subscribe.c
+++ b/modules/presence/subscribe.c
@@ -457,19 +457,23 @@ void delete_subs(str* pres_uri, str* ev_name, str* to_tag,
str* from_tag, str* callid)
{
subs_t subs;
+
memset(&subs, 0, sizeof(subs_t));
-
subs.pres_uri = *pres_uri;
subs.from_tag = *from_tag;
subs.to_tag = *to_tag;
subs.callid = *callid;
-
+
/* delete record from hash table also if not in dbonly mode */
if(subs_dbmode != DB_ONLY)
{
unsigned int hash_code= core_hash(pres_uri, ev_name, shtable_size);
- if(delete_shtable(subs_htable, hash_code, &subs) < 0)
- LM_ERR("Failed to delete subscription from memory\n");
+ if(delete_shtable(subs_htable, hash_code, &subs) < 0) {
+ LM_ERR("Failed to delete subscription from memory"
+ " [%.*s : %.*s / %.*s / %.*s]\n", ev_name->len, ev_name->s,
+ callid->len, callid->s, from_tag->len, from_tag->s,
+ to_tag->len, to_tag->s);
+ }
}
if(subs_dbmode != NO_DB && delete_db_subs(to_tag, from_tag, callid)< 0)