Make mpg123 behave more nicely

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5142 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2005-03-05 03:20:55 +00:00
parent 7f97f0a332
commit badc4dec46
3 changed files with 13 additions and 2 deletions

View File

@@ -945,11 +945,11 @@ static void ast_moh_destroy(void)
while (moh) {
if (moh->pid) {
ast_log(LOG_DEBUG, "killing %d!\n", moh->pid);
stime = time(NULL) + 5;
stime = time(NULL) + 2;
pid = moh->pid;
moh->pid = 0;
kill(pid, SIGKILL);
while ((bytes = read(moh->srcfd, buff, 8192)) && time(NULL) < stime) {
while ((ast_wait_for_input(moh->srcfd, 100) > -1) && (bytes = read(moh->srcfd, buff, 8192)) && time(NULL) < stime) {
tbytes = tbytes + bytes;
}
ast_log(LOG_DEBUG, "mpg123 pid %d and child died after %d bytes read\n", pid, tbytes);