TT#178351 presence: be more resilient doing clean up of presentity

* same approach to ps_ptable_timer_clean

Change-Id: Ibd44f612473ae76633c0ea43fa08e62fbe9af711
(cherry picked from commit e50bf8b61a)
mr10.5.2
Victor Seva 4 years ago committed by Víctor Seva
parent 829ad5d76c
commit a66858a8bc

@ -6,11 +6,11 @@ previously if an error was found we were bailing out and the value
was kept so at next round the value will be there and no more values was kept so at next round the value will be there and no more values
where removed where removed
--- ---
src/modules/presence/publish.c | 59 ++++++++++++++++++++++++++---------------- src/modules/presence/publish.c | 97 +++++++++++++++++++++++++-----------------
1 file changed, 37 insertions(+), 22 deletions(-) 1 file changed, 58 insertions(+), 39 deletions(-)
diff --git a/src/modules/presence/publish.c b/src/modules/presence/publish.c diff --git a/src/modules/presence/publish.c b/src/modules/presence/publish.c
index 8889a2e..9bd334f 100644 index 8889a2e..480ac7b 100644
--- a/src/modules/presence/publish.c --- a/src/modules/presence/publish.c
+++ b/src/modules/presence/publish.c +++ b/src/modules/presence/publish.c
@@ -69,6 +69,7 @@ void ps_presentity_db_timer_clean(unsigned int ticks, void *param) @@ -69,6 +69,7 @@ void ps_presentity_db_timer_clean(unsigned int ticks, void *param)
@ -137,3 +137,73 @@ index 8889a2e..9bd334f 100644
} }
} while(db_fetch_next(&pa_dbf, pres_fetch_rows, pa_db, &result) == 1 } while(db_fetch_next(&pa_dbf, pres_fetch_rows, pa_db, &result) == 1
&& RES_ROW_N(result) > 0); && RES_ROW_N(result) > 0);
@@ -277,22 +292,23 @@ void ps_ptable_timer_clean(unsigned int ticks, void *param)
pres.etag = ptn->etag;
pres.event = contains_event(&ptn->event, NULL);
if(pres.event == NULL || pres.event->evp == NULL) {
- LM_ERR("event not found\n");
- goto error;
+ LM_ERR("event[%.*s] not found\n", STR_FMT(&ptn->event));
+ goto next;
}
if(uandd_to_uri(pres.user, pres.domain, &uri) < 0) {
- LM_ERR("constructing uri\n");
- goto error;
+ LM_ERR("constructing uri from [user]=%.*s [domain]=%.*s\n",
+ STR_FMT(&pres.user), STR_FMT(&pres.domain));
+ goto next;
}
- LM_DBG("found expired publish for [user]=%.*s [domanin]=%.*s\n",
+ LM_DBG("found expired publish for [user]=%.*s [domain]=%.*s\n",
pres.user.len, pres.user.s, pres.domain.len, pres.domain.s);
if(pres_force_delete == 1) {
if(ps_ptable_remove(ptn) <0) {
LM_ERR("Deleting presentity\n");
- goto error;
+ goto next;
}
} else {
if(pres.event->get_rules_doc
@@ -300,25 +316,28 @@ void ps_ptable_timer_clean(unsigned int ticks, void *param)
&pres.user, &pres.domain, &rules_doc)
< 0) {
LM_ERR("getting rules doc\n");
- goto error;
+ goto next;
}
if(publ_notify(&pres, uri, NULL, &pres.etag, rules_doc) < 0) {
LM_ERR("sending Notify request\n");
- goto error;
- }
- if(rules_doc) {
- if(rules_doc->s)
- pkg_free(rules_doc->s);
- pkg_free(rules_doc);
- rules_doc = NULL;
+ goto next;
}
}
- pkg_free(uri.s);
- uri.s = NULL;
+next:
+ if(uri.s) {
+ pkg_free(uri.s);
+ uri.s = NULL;
+ }
+ if(rules_doc) {
+ if(rules_doc->s) {
+ pkg_free(rules_doc->s);
+ }
+ pkg_free(rules_doc);
+ rules_doc = NULL;
+ }
}
-error:
for(ptn = ptlist; ptn != NULL; ptn = ptn->next) {
if(ps_ptable_remove(ptn) <0) {
LM_ERR("failed deleting presentity item\n");

Loading…
Cancel
Save