[asterisk-commits] mjordan: trunk r349196 - in /trunk: ./ include/asterisk/ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 27 14:55:19 CST 2011
Author: mjordan
Date: Tue Dec 27 14:55:15 2011
New Revision: 349196
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=349196
Log:
Fix timing source dependency issues with MOH
Prior to this patch, res_musiconhold existed at the same module priority level
as the timing sources that it depends on. This would cause a problem when
music on hold was reloaded, as the timing source could be changed after
res_musiconhold was processed. This patch adds a new module priority level,
AST_MODPRI_TIMING, that the various timing modules are now loaded at. This
now occurs before loading other resource modules, such that the timing source
is guaranteed to be set prior to resolving the timing source dependencies.
(closes issue ASTERISK-17474)
Reporter: Luke H
Tested by: Luke H, Vladimir Mikhelson, zzsurf, Wes Van Tlghem, elguero, Thomas Arimont
Patches:
asterisk-17474-dahdi_timing-infinite-wait-fix_v3_branch-1.8.diff uploaded by elguero (License #5026)
asterisk-17474-dahdi_timing-infinite-wait-fix_v3_branch-10.diff uploaded by elguero (License #5026)
asterisk-17474-dahdi_timing-infinite-wait-fix_v3.diff uploaded by elguero (License #5026)
Review: https://reviewboard.asterisk.org/r/1578/
........
Merged revisions 349194 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 349195 from http://svn.asterisk.org/svn/asterisk/branches/10
Modified:
trunk/ (props changed)
trunk/include/asterisk/module.h
trunk/res/res_musiconhold.c
trunk/res/res_timing_dahdi.c
trunk/res/res_timing_pthread.c
trunk/res/res_timing_timerfd.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.
Modified: trunk/include/asterisk/module.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/module.h?view=diff&rev=349196&r1=349195&r2=349196
==============================================================================
--- trunk/include/asterisk/module.h (original)
+++ trunk/include/asterisk/module.h Tue Dec 27 14:55:15 2011
@@ -205,6 +205,7 @@
AST_MODPRI_REALTIME_DEPEND = 10, /*!< Dependency for a realtime driver */
AST_MODPRI_REALTIME_DEPEND2 = 20, /*!< Second level dependency for a realtime driver (func_curl needs res_curl, but is needed by res_config_curl) */
AST_MODPRI_REALTIME_DRIVER = 30, /*!< A realtime driver, which provides configuration services for other modules */
+ AST_MODPRI_TIMING = 40, /*!< Dependency for a channel (MOH needs timing interfaces to be fully loaded) */
AST_MODPRI_CHANNEL_DEPEND = 50, /*!< Channel driver dependency (may depend upon realtime, e.g. MOH) */
AST_MODPRI_CHANNEL_DRIVER = 60, /*!< Channel drivers (provide devicestate) */
AST_MODPRI_APP_DEPEND = 70, /*!< Dependency for an application */
Modified: trunk/res/res_musiconhold.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_musiconhold.c?view=diff&rev=349196&r1=349195&r2=349196
==============================================================================
--- trunk/res/res_musiconhold.c (original)
+++ trunk/res/res_musiconhold.c Tue Dec 27 14:55:15 2011
@@ -671,7 +671,7 @@
}
}
if (class->timer) {
- struct pollfd pfd = { .fd = ast_timer_fd(class->timer), .events = POLLIN, };
+ struct pollfd pfd = { .fd = ast_timer_fd(class->timer), .events = POLLIN | POLLPRI, };
#ifdef SOLARIS
thr_yield();
@@ -681,7 +681,7 @@
ast_timer_ack(class->timer, 1);
res = 320;
} else {
- ast_log(LOG_ERROR, "poll() failed: %s\n", strerror(errno));
+ ast_log(LOG_WARNING, "poll() failed: %s\n", strerror(errno));
res = 0;
}
pthread_testcancel();
@@ -1218,6 +1218,7 @@
if (!(class->timer = ast_timer_open())) {
ast_log(LOG_WARNING, "Unable to create timer: %s\n", strerror(errno));
+ return -1;
}
if (class->timer && ast_timer_set_rate(class->timer, 25)) {
ast_log(LOG_WARNING, "Unable to set 40ms frame rate: %s\n", strerror(errno));
@@ -1245,7 +1246,9 @@
{
struct mohclass *mohclass = NULL;
- if ((mohclass = _get_mohbyname(moh->name, 0, MOH_NOTDELETED, file, line, funcname)) && !moh_diff(mohclass, moh)) {
+ mohclass = _get_mohbyname(moh->name, 0, MOH_NOTDELETED, file, line, funcname);
+
+ if (mohclass && !moh_diff(mohclass, moh)) {
ast_log(LOG_WARNING, "Music on Hold class '%s' already exists\n", moh->name);
mohclass = mohclass_unref(mohclass, "unreffing mohclass we just found by name");
if (unref) {
@@ -1584,6 +1587,12 @@
ast_debug(1, "Destroying MOH class '%s'\n", class->name);
+ ao2_lock(class);
+ while ((member = AST_LIST_REMOVE_HEAD(&class->members, list))) {
+ free(member);
+ }
+ ao2_unlock(class);
+
/* Kill the thread first, so it cannot restart the child process while the
* class is being destroyed */
if (class->thread != AST_PTHREADT_NULL && class->thread != 0) {
@@ -1635,10 +1644,7 @@
ast_debug(1, "mpg123 pid %d and child died after %d bytes read\n", pid, tbytes);
close(class->srcfd);
- }
-
- while ((member = AST_LIST_REMOVE_HEAD(&class->members, list))) {
- free(member);
+ class->srcfd = -1;
}
if (class->filearray) {
@@ -1659,6 +1665,7 @@
if (tid > 0) {
pthread_join(tid, NULL);
}
+
}
static int moh_class_mark(void *obj, void *arg, int flags)
Modified: trunk/res/res_timing_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_timing_dahdi.c?view=diff&rev=349196&r1=349195&r2=349196
==============================================================================
--- trunk/res/res_timing_dahdi.c (original)
+++ trunk/res/res_timing_dahdi.c Tue Dec 27 14:55:15 2011
@@ -203,5 +203,5 @@
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "DAHDI Timing Interface",
.load = load_module,
.unload = unload_module,
- .load_pri = AST_MODPRI_CHANNEL_DEPEND,
+ .load_pri = AST_MODPRI_TIMING,
);
Modified: trunk/res/res_timing_pthread.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_timing_pthread.c?view=diff&rev=349196&r1=349195&r2=349196
==============================================================================
--- trunk/res/res_timing_pthread.c (original)
+++ trunk/res/res_timing_pthread.c Tue Dec 27 14:55:15 2011
@@ -525,5 +525,5 @@
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "pthread Timing Interface",
.load = load_module,
.unload = unload_module,
- .load_pri = AST_MODPRI_CHANNEL_DEPEND,
+ .load_pri = AST_MODPRI_TIMING,
);
Modified: trunk/res/res_timing_timerfd.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_timing_timerfd.c?view=diff&rev=349196&r1=349195&r2=349196
==============================================================================
--- trunk/res/res_timing_timerfd.c (original)
+++ trunk/res/res_timing_timerfd.c Tue Dec 27 14:55:15 2011
@@ -337,5 +337,5 @@
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Timerfd Timing Interface",
.load = load_module,
.unload = unload_module,
- .load_pri = AST_MODPRI_CHANNEL_DEPEND,
+ .load_pri = AST_MODPRI_TIMING,
);
More information about the asterisk-commits
mailing list