diff --git a/daemon/call.c b/daemon/call.c index 0e07da949..e14da307e 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -495,7 +495,7 @@ destroy: free(url_suffix); } -void call_timer(void *ptr) { +enum thread_looper_action call_timer() { struct iterator_helper hlp; ZERO(hlp); @@ -511,6 +511,8 @@ void call_timer(void *ptr) { /* add thread scope (local) sockets to the global list, in order to release them later */ append_thread_lpr_to_glob_lpr(); + + return TLA_CONTINUE; } #undef DS @@ -524,7 +526,8 @@ int call_init() { for (int i = 0; i < NUM_CALL_ITERATORS; i++) mutex_init(&rtpe_call_iterators[i].lock); - poller_add_timer(rtpe_poller, call_timer, NULL); + thread_create_looper(call_timer, rtpe_config.idle_scheduling, + rtpe_config.idle_priority, "kill calls timer", 1000000); if (mqtt_publish_scope() != MPS_NONE) mqtt_timer_start(&global_mqtt_timer, NULL, NULL); diff --git a/include/call.h b/include/call.h index 1b3f1c39c..b7981ad05 100644 --- a/include/call.h +++ b/include/call.h @@ -754,7 +754,7 @@ int call_stream_address46(char *o, struct packet_stream *ps, enum stream_address int *len, const struct local_intf *ifa, bool keep_unspec); void add_total_calls_duration_in_interval(struct timeval *interval_tv); -void call_timer(void *ptr); +enum thread_looper_action call_timer(void); void __rtp_stats_update(GHashTable *dst, struct codec_store *); int __init_stream(struct packet_stream *ps); diff --git a/t/test-stats.c b/t/test-stats.c index a0dfb3ebe..585080d4c 100644 --- a/t/test-stats.c +++ b/t/test-stats.c @@ -3230,7 +3230,7 @@ int main(void) { // test cmd_ps_min/max/avg - call_timer(NULL); + call_timer(); stats_counters_calc_rate(&rtpe_stats, 150000000, &rtpe_stats_intv, &rtpe_stats_rate); stats_rate_min_max(&rtpe_rate_graphite_min_max, &rtpe_stats_rate); ice_slow_timer(); @@ -3239,7 +3239,7 @@ int main(void) { rtpe_now.tv_sec += 2; RTPE_STATS_ADD(ng_commands[NGC_OFFER], 20); - call_timer(NULL); + call_timer(); stats_counters_calc_rate(&rtpe_stats, 2000000, &rtpe_stats_intv, &rtpe_stats_rate); stats_rate_min_max(&rtpe_rate_graphite_min_max, &rtpe_stats_rate); ice_slow_timer(); @@ -3248,7 +3248,7 @@ int main(void) { rtpe_now.tv_sec += 5; RTPE_STATS_ADD(ng_commands[NGC_OFFER], 200); - call_timer(NULL); + call_timer(); stats_counters_calc_rate(&rtpe_stats, 5000000, &rtpe_stats_intv, &rtpe_stats_rate); stats_rate_min_max(&rtpe_rate_graphite_min_max, &rtpe_stats_rate); ice_slow_timer();