Module: kamailio Branch: master Commit: 39b162122964bc9ef04b0fa32b9ce9eaf1d9530b URL: https://github.com/kamailio/kamailio/commit/39b162122964bc9ef04b0fa32b9ce9ea...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2016-11-14T16:30:07+01:00
htable: use lookup instead of get for event route item expiration
- get creates an empty structure which is not used
---
Modified: modules/htable/ht_api.c Modified: modules/htable/ht_api.h
---
Diff: https://github.com/kamailio/kamailio/commit/39b162122964bc9ef04b0fa32b9ce9ea... Patch: https://github.com/kamailio/kamailio/commit/39b162122964bc9ef04b0fa32b9ce9ea...
---
diff --git a/modules/htable/ht_api.c b/modules/htable/ht_api.c index b96ff13..64e9058 100644 --- a/modules/htable/ht_api.c +++ b/modules/htable/ht_api.c @@ -362,7 +362,7 @@ int ht_init_tables(void) { strcpy(route_name, "htable:expired:"); strncat(route_name, ht->name.s, ht->name.len); - ht->evrt_expired = route_get(&event_rt, route_name); + ht->evrt_expired = route_lookup(&event_rt, route_name);
if (ht->evrt_expired < 0 || event_rt.rlist[ht->evrt_expired] == NULL) @@ -1079,24 +1079,22 @@ void ht_handle_expired_record(ht_t *ht, ht_cell_t *cell)
LM_DBG("running event_route[htable:expired:%.*s]\n", ht->name.len, ht->name.s); - ht_expired_run_event_route(ht->evrt_expired); + ht_expired_run_event_route(ht);
ht_expired_cell = NULL; }
-void ht_expired_run_event_route(int routeid) +void ht_expired_run_event_route(ht_t *ht) { int backup_rt; sip_msg_t *fmsg;
- if (routeid < 0 || event_rt.rlist[routeid] == NULL) - { + if (ht->evrt_expired < 0 || event_rt.rlist[ht->evrt_expired] == NULL) { LM_DBG("route does not exist\n"); return; }
- if (faked_msg_init() < 0) - { + if (faked_msg_init() < 0) { LM_ERR("faked_msg_init() failed\n"); return; } @@ -1106,7 +1104,7 @@ void ht_expired_run_event_route(int routeid) backup_rt = get_route_type();
set_route_type(EVENT_ROUTE); - run_top_route(event_rt.rlist[routeid], fmsg, 0); + run_top_route(event_rt.rlist[ht->evrt_expired], fmsg, 0);
set_route_type(backup_rt); } diff --git a/modules/htable/ht_api.h b/modules/htable/ht_api.h index a37e98f..5169378 100644 --- a/modules/htable/ht_api.h +++ b/modules/htable/ht_api.h @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - + #ifndef _HT_API_H_ #define _HT_API_H_
@@ -103,7 +103,7 @@ int ht_db_sync_tables(void); int ht_has_autoexpire(void); void ht_timer(unsigned int ticks, void *param); void ht_handle_expired_record(ht_t *ht, ht_cell_t *cell); -void ht_expired_run_event_route(int routeid); +void ht_expired_run_event_route(ht_t *ht); int ht_set_cell_expire(ht_t *ht, str *name, int type, int_str *val); int ht_get_cell_expire(ht_t *ht, str *name, unsigned int *val);