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