Finished new task handling

This commit is contained in:
Michiel Broek 2006-02-04 13:56:21 +00:00
parent a41d4dab47
commit 0ed5a3527d

View File

@ -563,15 +563,13 @@ void taskdie(int onsig)
{ {
int i, status; int i, status;
Syslog('t', "taskdie(%s)", SigName[onsig]);
for (i = 0; i < MAXTASKS; i++) { for (i = 0; i < MAXTASKS; i++) {
if (strlen(task[i].name)) { if (strlen(task[i].name)) {
task[i].rc = wait4(task[i].pid, &status, WNOHANG | WUNTRACED, NULL); task[i].rc = wait4(task[i].pid, &status, WNOHANG | WUNTRACED, NULL);
if (task[i].rc) { if (task[i].rc) {
task[i].running = FALSE; task[i].running = FALSE;
task[i].status = status; task[i].status = status;
Syslog('t', "taskdie() set task %d not running, rc=%d, status=%d", i, task[i].rc, status); Syslog('t', "taskdie() set task %d got signal, rc=%d, status=%d", i, task[i].rc, status);
} }
} }
} }
@ -598,11 +596,12 @@ int checktasks(int onsig)
Syslog('+', "%s to %s (pid %d) failed", SigName[onsig], task[i].name, task[i].pid); Syslog('+', "%s to %s (pid %d) failed", SigName[onsig], task[i].name, task[i].pid);
} }
// task[i].rc = wait4(task[i].pid, &status, WNOHANG | WUNTRACED, NULL); /*
// if (task[i].rc) { * If task was set not running by taskdie(), handle status
// task[i].running = FALSE; */
if (task[i].running) {
if (task[i].running == FALSE) { count++;
} else {
/* /*
* If a mailer call is finished, set the global rescan flag. * If a mailer call is finished, set the global rescan flag.
*/ */
@ -616,9 +615,8 @@ int checktasks(int onsig)
deinitnl(); deinitnl();
initnl(); initnl();
} }
}
if (first && task[i].rc) { if (first) {
first = FALSE; first = FALSE;
Syslog('t', "Task Type pid stat"); Syslog('t', "Task Type pid stat");
Syslog('t', "---------------- ------- ----- ----"); Syslog('t', "---------------- ------- ----- ----");
@ -636,11 +634,6 @@ int checktasks(int onsig)
Syslog('+', "Task %d \"%s\" is ready, error: %s", i, task[i].name, strerror(errno)); Syslog('+', "Task %d \"%s\" is ready, error: %s", i, task[i].name, strerror(errno));
break; break;
case 0: case 0:
/*
* Update last known status when running.
*/
// task[i].status = status;
count++;
break; break;
default: default:
if (WIFEXITED(task[i].status)) { if (WIFEXITED(task[i].status)) {
@ -665,7 +658,6 @@ int checktasks(int onsig)
break; break;
} }
if (!task[i].running) {
for (j = 0; j < MAXTASKS; j++) { for (j = 0; j < MAXTASKS; j++) {
if (calllist[j].taskpid == task[i].pid) { if (calllist[j].taskpid == task[i].pid) {
calllist[j].calling = FALSE; calllist[j].calling = FALSE;