... | ... |
@@ -69,6 +69,7 @@ void ps_presentity_db_timer_clean(unsigned int ticks, void *param) |
69 | 69 |
int n_db_cols = 0, n_result_cols = 0; |
70 | 70 |
int event_col, etag_col, user_col, domain_col; |
71 | 71 |
int i = 0, num_watchers = 0; |
72 |
+ pres_ev_t fake; |
|
72 | 73 |
presentity_t pres; |
73 | 74 |
str uri = {0, 0}, event, *rules_doc = NULL; |
74 | 75 |
static str query_str; |
... | ... |
@@ -134,20 +135,25 @@ void ps_presentity_db_timer_clean(unsigned int ticks, void *param) |
134 | 135 |
event.len = strlen(event.s); |
135 | 136 |
pres.event = contains_event(&event, NULL); |
136 | 137 |
if(pres.event == NULL || pres.event->evp == NULL) { |
137 |
- LM_ERR("event not found\n"); |
|
138 |
- goto error; |
|
138 |
+ LM_ERR("event[%.*s] not found\n", STR_FMT(&event)); |
|
139 |
+ memset(&fake, 0, sizeof(pres_ev_t)); |
|
140 |
+ fake.name = event; |
|
141 |
+ pres.event = &fake; |
|
142 |
+ goto simple_error; |
|
139 | 143 |
} |
140 | 144 |
|
141 | 145 |
if(uandd_to_uri(pres.user, pres.domain, &uri) < 0) { |
142 |
- LM_ERR("constructing uri\n"); |
|
143 |
- goto error; |
|
146 |
+ LM_ERR("constructing uri from [user]=%.*s [domanin]=%.*s\n", |
|
147 |
+ STR_FMT(&pres.user), STR_FMT(&pres.domain)); |
|
148 |
+ goto simple_error; |
|
144 | 149 |
} |
145 | 150 |
|
146 | 151 |
/* delete from hash table */ |
147 | 152 |
if(publ_cache_mode==PS_PCACHE_HYBRID |
148 | 153 |
&& delete_phtable(&uri, pres.event->evp->type) < 0) { |
149 |
- LM_ERR("deleting from presentity hash table\n"); |
|
150 |
- goto error; |
|
154 |
+ LM_ERR("deleting uri[%.*s] event[%.*s] from presentity hash table\n", |
|
155 |
+ STR_FMT(&uri), STR_FMT(&event)); |
|
156 |
+ goto simple_error; |
|
151 | 157 |
} |
152 | 158 |
|
153 | 159 |
LM_DBG("found expired publish for [user]=%.*s [domanin]=%.*s\n", |
... | ... |
@@ -171,7 +177,7 @@ void ps_presentity_db_timer_clean(unsigned int ticks, void *param) |
171 | 177 |
if(pa_dbf.abort_transaction(pa_db) < 0) |
172 | 178 |
LM_ERR("in abort_transaction\n"); |
173 | 179 |
} |
174 |
- goto error; |
|
180 |
+ goto simple_error; |
|
175 | 181 |
} |
176 | 182 |
|
177 | 183 |
if(num_watchers > 0) { |
... | ... |
@@ -201,22 +207,29 @@ void ps_presentity_db_timer_clean(unsigned int ticks, void *param) |
201 | 207 |
&pres.user, &pres.domain, &rules_doc) |
202 | 208 |
< 0) { |
203 | 209 |
LM_ERR("getting rules doc\n"); |
204 |
- goto error; |
|
210 |
+ goto simple_error; |
|
205 | 211 |
} |
206 | 212 |
if(publ_notify(&pres, uri, NULL, &pres.etag, rules_doc) < 0) { |
207 | 213 |
LM_ERR("sending Notify request\n"); |
208 |
- goto error; |
|
209 |
- } |
|
210 |
- if(rules_doc) { |
|
211 |
- if(rules_doc->s) |
|
212 |
- pkg_free(rules_doc->s); |
|
213 |
- pkg_free(rules_doc); |
|
214 |
- rules_doc = NULL; |
|
214 |
+ goto simple_error; |
|
215 | 215 |
} |
216 | 216 |
} |
217 | 217 |
|
218 |
- pkg_free(uri.s); |
|
219 |
- uri.s = NULL; |
|
218 |
+simple_error: |
|
219 |
+ if(delete_presentity(&pres, NULL) < 0) { |
|
220 |
+ LM_ERR("Deleting presentity\n"); |
|
221 |
+ } |
|
222 |
+ if(uri.s) { |
|
223 |
+ pkg_free(uri.s); |
|
224 |
+ uri.s = NULL; |
|
225 |
+ } |
|
226 |
+ if(rules_doc) { |
|
227 |
+ if(rules_doc->s) { |
|
228 |
+ pkg_free(rules_doc->s); |
|
229 |
+ } |
|
230 |
+ pkg_free(rules_doc); |
|
231 |
+ rules_doc = NULL; |
|
232 |
+ } |
|
220 | 233 |
} |
221 | 234 |
} while(db_fetch_next(&pa_dbf, pres_fetch_rows, pa_db, &result) == 1 |
222 | 235 |
&& RES_ROW_N(result) > 0); |