Module: kamailio
Branch: master
Commit: d43e8965640bbc64e56ef33f27d4f3c3a85c73fa
URL:
https://github.com/kamailio/kamailio/commit/d43e8965640bbc64e56ef33f27d4f3c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-01-15T17:54:18+01:00
presence: fix counter and type for removing presentity from cache
- report and patch by Kristian F. Høgh
---
Modified: modules/presence/event_list.h
Modified: modules/presence/hash.c
Modified: modules/presence/publish.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d43e8965640bbc64e56ef33f27d4f3c…
Patch:
https://github.com/kamailio/kamailio/commit/d43e8965640bbc64e56ef33f27d4f3c…
---
diff --git a/modules/presence/event_list.h b/modules/presence/event_list.h
index 2ebcafc..29511cb 100644
--- a/modules/presence/event_list.h
+++ b/modules/presence/event_list.h
@@ -83,7 +83,7 @@ struct pres_ev
event_t* evp;
str content_type;
int default_expires;
- int type;
+ int type; /* category type: WINFO_TIPE, PUBL_TYPE, ...*/
int etag_not_new;
/*
* 0 - the standard mechanism (allocating new etag for each Publish)
diff --git a/modules/presence/hash.c b/modules/presence/hash.c
index 6e85d37..11d9e3e 100644
--- a/modules/presence/hash.c
+++ b/modules/presence/hash.c
@@ -533,14 +533,16 @@ int insert_phtable(str* pres_uri, int event, char* sphere)
if(p->sphere== NULL)
{
lock_release(&pres_htable[hash_code].lock);
+ shm_free(p);
ERR_MEM(SHARE_MEM);
}
strcpy(p->sphere, sphere);
}
p->event= event;
-
+ p->publ_count=1;
+ /* link the item in the hash table */
p->next= pres_htable[hash_code].entries->next;
pres_htable[hash_code].entries->next= p;
diff --git a/modules/presence/publish.c b/modules/presence/publish.c
index 46ec334..4ca9afb 100644
--- a/modules/presence/publish.c
+++ b/modules/presence/publish.c
@@ -134,7 +134,7 @@ void msg_presentity_clean(unsigned int ticks,void *param)
event.s = (char *) VAL_STRING(&values[event_col]);
event.len = strlen(event.s);
pres.event= contains_event(&event, NULL);
- if(pres.event== NULL)
+ if(pres.event==NULL || pres.event->evp==NULL)
{
LM_ERR("event not found\n");
goto error;
@@ -147,7 +147,7 @@ void msg_presentity_clean(unsigned int ticks,void *param)
}
/* delete from hash table */
- if(publ_cache_enabled && delete_phtable(&uri, pres.event->type)< 0)
+ if(publ_cache_enabled && delete_phtable(&uri,
pres.event->evp->type)< 0)
{
LM_ERR("deleting from pres hash table\n");
goto error;