[asterisk-commits] branch north/chan_skinny-fixup r21031 - in
/team/north/chan_skinny-fixup: ./ ...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Apr 17 12:04:15 MST 2006
Author: north
Date: Mon Apr 17 14:04:11 2006
New Revision: 21031
URL: http://svn.digium.com/view/asterisk?rev=21031&view=rev
Log:
update to latest trunk, after automerge failure
Modified:
team/north/chan_skinny-fixup/ (props changed)
team/north/chan_skinny-fixup/res/res_musiconhold.c
Propchange: team/north/chan_skinny-fixup/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.
Propchange: team/north/chan_skinny-fixup/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/north/chan_skinny-fixup/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Apr 17 14:04:11 2006
@@ -1,1 +1,1 @@
-/trunk:1-20975
+/trunk:1-21030
Modified: team/north/chan_skinny-fixup/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/team/north/chan_skinny-fixup/res/res_musiconhold.c?rev=21031&r1=21030&r2=21031&view=diff
==============================================================================
--- team/north/chan_skinny-fixup/res/res_musiconhold.c (original)
+++ team/north/chan_skinny-fixup/res/res_musiconhold.c Mon Apr 17 14:04:11 2006
@@ -168,6 +168,10 @@
members = members->next;
free(mtmp);
}
+ if ((*class)->thread) {
+ pthread_cancel((*class)->thread);
+ (*class)->thread = 0;
+ }
free(*class);
*class = NULL;
}
@@ -483,17 +487,20 @@
tv.tv_sec = 0;
tv.tv_usec = 0;
for(;/* ever */;) {
+ pthread_testcancel();
/* Spawn mp3 player if it's not there */
if (class->srcfd < 0) {
if ((class->srcfd = spawn_mp3(class)) < 0) {
ast_log(LOG_WARNING, "Unable to spawn mp3player\n");
/* Try again later */
sleep(500);
+ pthread_testcancel();
}
}
if (class->pseudofd > -1) {
/* Pause some amount of time */
res = read(class->pseudofd, buf, sizeof(buf));
+ pthread_testcancel();
} else {
long delta;
/* Reliable sleep */
@@ -504,6 +511,7 @@
if (delta < MOH_MS_INTERVAL) { /* too early */
tv = ast_tvadd(tv, ast_samp2tv(MOH_MS_INTERVAL, 1000)); /* next deadline */
usleep(1000 * (MOH_MS_INTERVAL - delta));
+ pthread_testcancel();
} else {
ast_log(LOG_NOTICE, "Request to schedule in the past?!?!\n");
tv = tv_tmp;
@@ -519,7 +527,12 @@
if (!res2) {
close(class->srcfd);
class->srcfd = -1;
+ pthread_testcancel();
if (class->pid) {
+ kill(class->pid, SIGHUP);
+ usleep(100000);
+ kill(class->pid, SIGTERM);
+ usleep(100000);
kill(class->pid, SIGKILL);
class->pid = 0;
}
@@ -527,6 +540,7 @@
ast_log(LOG_DEBUG, "Read %d bytes of audio while expecting %d\n", res2, len);
continue;
}
+ pthread_testcancel();
ast_mutex_lock(&moh_lock);
moh = class->members;
while (moh) {
@@ -1064,6 +1078,13 @@
stime = time(NULL) + 2;
pid = moh->pid;
moh->pid = 0;
+ /* Back when this was just mpg123, SIGKILL was fine. Now we need
+ * to give the process a reason and time enough to kill off its
+ * children. */
+ kill(pid, SIGHUP);
+ usleep(100000);
+ kill(pid, SIGTERM);
+ usleep(100000);
kill(pid, SIGKILL);
while ((ast_wait_for_input(moh->srcfd, 100) > 0) && (bytes = read(moh->srcfd, buff, 8192)) && time(NULL) < stime) {
tbytes = tbytes + bytes;
More information about the asterisk-commits
mailing list