Skip to content
Snippets Groups Projects
Commit 174697b7 authored by Russell Bryant's avatar Russell Bryant
Browse files

Fix some timer state corruption.

In res_timer_timerfd, handle the case that set_rate gets called while a timer
is still in continuous mode.  In this case, we want to remember the configured
rate, but not actually set it until continuous mode has been disabled.

Thanks to dvossel for finding and helping to debug the problem.

(closes issue #15080)
Reported by: dvossel
Tested by: dvossel


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@193718 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent 52541f5a
No related branches found
No related tags found
No related merge requests found
......@@ -134,7 +134,7 @@ static int timerfd_timer_set_rate(int handle, unsigned int rate)
struct timerfd_timer *our_timer, find_helper = {
.handle = handle,
};
int res;
int res = 0;
if (!(our_timer = ao2_find(timerfd_timers, &find_helper, OBJ_POINTER))) {
ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle);
......@@ -146,7 +146,9 @@ static int timerfd_timer_set_rate(int handle, unsigned int rate)
our_timer->saved_timer.it_interval.tv_sec = our_timer->saved_timer.it_value.tv_sec;
our_timer->saved_timer.it_interval.tv_nsec = our_timer->saved_timer.it_value.tv_nsec;
res = timerfd_settime(handle, 0, &our_timer->saved_timer, NULL);
if (!our_timer->is_continuous) {
res = timerfd_settime(handle, 0, &our_timer->saved_timer, NULL);
}
ao2_ref(our_timer, -1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment