Module: kamailio
Branch: master
Commit: ff174bb6432b3bb971f8b291c9420545c858ef19
URL:
https://github.com/kamailio/kamailio/commit/ff174bb6432b3bb971f8b291c942054…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-04-20T09:12:24+02:00
presence: init and destroy full presentity caching table
---
Modified: src/modules/presence/presence.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ff174bb6432b3bb971f8b291c942054…
Patch:
https://github.com/kamailio/kamailio/commit/ff174bb6432b3bb971f8b291c942054…
---
diff --git a/src/modules/presence/presence.c b/src/modules/presence/presence.c
index 779a6016fd..4100de87a1 100644
--- a/src/modules/presence/presence.c
+++ b/src/modules/presence/presence.c
@@ -406,12 +406,14 @@ static int mod_init(void)
}
}
- if(publ_cache_mode==PS_PCACHE_HYBRID) {
+ if(publ_cache_mode==PS_PCACHE_HYBRID || publ_cache_mode==PS_PCACHE_RECORD) {
if(phtable_size < 1)
phtable_size = 256;
else
phtable_size = 1 << phtable_size;
+ }
+ if(publ_cache_mode==PS_PCACHE_HYBRID) {
pres_htable = new_phtable();
if(pres_htable == NULL) {
LM_ERR("initializing presentity hash table\n");
@@ -422,6 +424,10 @@ static int mod_init(void)
LM_ERR("filling in presentity hash table from database\n");
goto dberror;
}
+ } else if(publ_cache_mode==PS_PCACHE_RECORD) {
+ if(ps_ptable_init(phtable_size) < 0) {
+ goto dberror;
+ }
}
pres_startup_time = (int)time(NULL);
@@ -594,19 +600,25 @@ static void destroy(void)
timer_db_update(0, 0);
}
- if(subs_htable)
+ if(subs_htable) {
destroy_shtable(subs_htable, shtable_size);
+ }
- if(pres_htable)
+ if(pres_htable) {
destroy_phtable();
+ }
- if(pa_db && pa_dbf.close)
+ if(pa_db && pa_dbf.close) {
pa_dbf.close(pa_db);
+ }
- if(pres_notifier_id != NULL)
+ if(pres_notifier_id != NULL) {
shm_free(pres_notifier_id);
+ }
destroy_evlist();
+
+ ps_ptable_destroy();
}
static int fixup_presence(void **param, int param_no)