[svn-commits] jpeeler: trunk r294279 - in /trunk: ./ include/asterisk/ main/ res/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Nov 8 16:04:09 CST 2010


Author: jpeeler
Date: Mon Nov  8 16:03:54 2010
New Revision: 294279

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=294279
Log:
Merged revisions 294278 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r294278 | jpeeler | 2010-11-08 15:59:45 -0600 (Mon, 08 Nov 2010) | 23 lines
  
  Merged revisions 294277 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ........
    r294277 | jpeeler | 2010-11-08 15:58:13 -0600 (Mon, 08 Nov 2010) | 16 lines
    
    Fix playback failure when using IAX with the timerfd module.
    
    To fix this issue the alert pipe will now be used when the timerfd module is
    in use. There appeared to be a race that was not solved by adding locking in the
    timerfd module, but needed to be there anyway. The race was between the timer
    being put in non-continuous mode in ast_read on the channel thread and the IAX 
    frame scheduler queuing a frame which would enable continuous mode before the
    non-continuous mode event was read. This race for now is simply avoided.
    
    (closes issue #18110)
    Reported by: tpanton
    Tested by: tpanton
    
    I put tested by tpanton because it was tested on his hardware. Thanks for the
    remote access to debug this issue!
  ........
................

Modified:
    trunk/   (props changed)
    trunk/include/asterisk/timing.h
    trunk/main/channel.c
    trunk/main/timing.c
    trunk/res/res_timing_timerfd.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: trunk/include/asterisk/timing.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/timing.h?view=diff&rev=294279&r1=294278&r2=294279
==============================================================================
--- trunk/include/asterisk/timing.h (original)
+++ trunk/include/asterisk/timing.h Mon Nov  8 16:03:54 2010
@@ -216,6 +216,16 @@
  */
 unsigned int ast_timer_get_max_rate(const struct ast_timer *handle);
 
+/*!
+ * \brief Get name of timer in use
+ *
+ * \param handle timer handle returned by timer_open()
+ *
+ * \return name of timer
+ * \since 1.6.2
+ */
+const char *ast_timer_get_name(const struct ast_timer *handle);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=294279&r1=294278&r2=294279
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Mon Nov  8 16:03:54 2010
@@ -1129,7 +1129,9 @@
 	}
 
 	if ((tmp->timer = ast_timer_open())) {
-		needqueue = 0;
+		if (strcmp(ast_timer_get_name(tmp->timer), "timerfd")) {
+			needqueue = 0;
+		}
 		tmp->timingfd = ast_timer_fd(tmp->timer);
 	}
 

Modified: trunk/main/timing.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/timing.c?view=diff&rev=294279&r1=294278&r2=294279
==============================================================================
--- trunk/main/timing.c (original)
+++ trunk/main/timing.c Mon Nov  8 16:03:54 2010
@@ -205,6 +205,11 @@
 	return res;
 }
 
+const char *ast_timer_get_name(const struct ast_timer *handle)
+{
+	return handle->holder->iface->name;
+}
+
 static char *timing_test(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct ast_timer *timer;

Modified: trunk/res/res_timing_timerfd.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_timing_timerfd.c?view=diff&rev=294279&r1=294278&r2=294279
==============================================================================
--- trunk/res/res_timing_timerfd.c (original)
+++ trunk/res/res_timing_timerfd.c Mon Nov  8 16:03:54 2010
@@ -140,6 +140,7 @@
 		ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle);
 		return -1;
 	}
+	ao2_lock(our_timer);
 
 	our_timer->saved_timer.it_value.tv_sec = 0;
 	our_timer->saved_timer.it_value.tv_nsec = rate ? (long) (1000000000 / rate) : 0L;
@@ -150,6 +151,7 @@
 		res = timerfd_settime(handle, 0, &our_timer->saved_timer, NULL);
 	}
 
+	ao2_unlock(our_timer);
 	ao2_ref(our_timer, -1);
 
 	return res;
@@ -191,17 +193,20 @@
 		ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle);
 		return -1;
 	}
+	ao2_lock(our_timer);
 
 	if (our_timer->is_continuous) {
 		/*It's already in continous mode, no need to do
 		 * anything further
 		 */
+		ao2_unlock(our_timer);
 		ao2_ref(our_timer, -1);
 		return 0;
 	}
 
 	res = timerfd_settime(handle, 0, &continuous_timer, &our_timer->saved_timer);
 	our_timer->is_continuous = 1;
+	ao2_unlock(our_timer);
 	ao2_ref(our_timer, -1);
 	return res;
 }
@@ -217,6 +222,7 @@
 		ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle);
 		return -1;
 	}
+	ao2_lock(our_timer);
 
 	if(!our_timer->is_continuous) {
 		/* No reason to do anything if we're not
@@ -229,6 +235,7 @@
 	res = timerfd_settime(handle, 0, &our_timer->saved_timer, NULL);
 	our_timer->is_continuous = 0;
 	memset(&our_timer->saved_timer, 0, sizeof(our_timer->saved_timer));
+	ao2_unlock(our_timer);
 	ao2_ref(our_timer, -1);
 	return res;
 }
@@ -244,6 +251,7 @@
 		ast_log(LOG_ERROR, "Couldn't find timer with handle %d\n", handle);
 		return -1;
 	}
+	ao2_lock(our_timer);
 
 	if (our_timer->is_continuous) {
 		res = AST_TIMING_EVENT_CONTINUOUS;
@@ -251,6 +259,7 @@
 		res = AST_TIMING_EVENT_EXPIRED;
 	}
 
+	ao2_unlock(our_timer);
 	ao2_ref(our_timer, -1);
 	return res;
 }




More information about the svn-commits mailing list