? core.5034 ? moh.diff Index: res_musiconhold.c =================================================================== RCS file: /usr/cvsroot/asterisk/res/res_musiconhold.c,v retrieving revision 1.1.1.5 diff -u -r1.1.1.5 res_musiconhold.c --- res_musiconhold.c 18 Mar 2003 06:00:18 -0000 1.1.1.5 +++ res_musiconhold.c 20 May 2003 10:36:58 -0000 @@ -530,11 +530,20 @@ static void ast_moh_destroy(void) { struct mohclass *moh; + char buff[8192]; + int bytes, tbytes, stime = 0; ast_pthread_mutex_lock(&moh_lock); moh = mohclasses; while(moh) { if (moh->pid) { - kill(moh->pid, SIGKILL); + ast_log(LOG_DEBUG, "killing %d!\n", moh->pid); + stime = time(NULL); + kill(moh->pid, SIGABRT); + while (bytes = read(moh->srcfd, buff, 8192) && time(NULL) < stime + 5) { + tbytes = tbytes + bytes; + } + ast_log(LOG_DEBUG, "mpg123 pid %d and child died after %d bytes read\n", moh->pid, tbytes); + close(moh->srcfd); moh->pid = 0; } moh = moh->next;