diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2009-03-18 17:09:48 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2009-03-18 17:09:48 +0000 |
commit | 238c38326574f7793dc1deda72f6aff208d791dc (patch) | |
tree | 0bfc3034b2b928bfff2ed6e7ee1d53a0b0c194a6 /scheduler/main.c | |
parent | 8b116e60045b961964b5689bf0181aef9a479656 (diff) | |
download | cups-238c38326574f7793dc1deda72f6aff208d791dc.tar.gz |
Merge changes from CUPS 1.4svn-r8454.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@1311 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'scheduler/main.c')
-rw-r--r-- | scheduler/main.c | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/scheduler/main.c b/scheduler/main.c index d78280f98..3a8668902 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -714,22 +714,12 @@ main(int argc, /* I - Number of command-line args */ } /* - * Check for any active jobs... - */ - - for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs); - job; - job = (cupsd_job_t *)cupsArrayNext(ActiveJobs)) - if (job->state_value == IPP_JOB_PROCESSING) - break; - - /* * Restart if all clients are closed and all jobs finished, or * if the reload timeout has elapsed... */ if ((cupsArrayCount(Clients) == 0 && - (!job || NeedReload != RELOAD_ALL)) || + (cupsArrayCount(PrintingJobs) == 0 || NeedReload != RELOAD_ALL)) || (time(NULL) - ReloadTime) >= ReloadTimeout) { /* @@ -890,7 +880,7 @@ main(int argc, /* I - Number of command-line args */ cupsArrayCount(PrintingJobs) > 0) { SleepJobs = 0; - cupsdStopAllJobs(0); + cupsdStopAllJobs(CUPSD_JOB_DEFAULT, 10); } #endif /* __APPLE__ */ @@ -1961,22 +1951,27 @@ select_timeout(int fds) /* I - Number of descriptors returned */ * Check for any active jobs... */ - if (cupsArrayCount(ActiveJobs) > 0) + for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs); + job; + job = (cupsd_job_t *)cupsArrayNext(ActiveJobs)) { - for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs); - job; - job = (cupsd_job_t *)cupsArrayNext(ActiveJobs)) - if (job->state_value == IPP_JOB_HELD && job->hold_until < timeout) - { - timeout = job->hold_until; - why = "release held jobs"; - } - else if (job->state_value == IPP_JOB_PENDING && timeout > (now + 10)) - { - timeout = now + 10; - why = "start pending jobs"; - break; - } + if (job->kill_time && job->kill_time < timeout) + { + timeout = job->kill_time; + why = "kill unresponsive jobs"; + } + + if (job->state_value == IPP_JOB_HELD && job->hold_until < timeout) + { + timeout = job->hold_until; + why = "release held jobs"; + } + else if (job->state_value == IPP_JOB_PENDING && timeout > (now + 10)) + { + timeout = now + 10; + why = "start pending jobs"; + break; + } } #ifdef HAVE_MALLINFO |