From: msweet Date: Wed, 11 Sep 2013 17:45:56 +0000 (+0000) Subject: Seed: Print queue JOBS disappear after computer Wakes up... X-Git-Tag: v2.2b1~857 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=982069db845d14f9db8b863f037bfba6fe4b4e0f;p=thirdparty%2Fcups.git Seed: Print queue JOBS disappear after computer Wakes up from Sleep. Reset cancel time after wake from sleep, support job-cancel-after Job Template attribute to allow command jobs to be canceled after a suitable amount of time. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11280 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/doc/help/man-cups-files.conf.html b/doc/help/man-cups-files.conf.html index 3e30a9d98d..8c3a610fd4 100644 --- a/doc/help/man-cups-files.conf.html +++ b/doc/help/man-cups-files.conf.html @@ -140,14 +140,6 @@ be found.
Specifies the directory where the server configuration files can be found.
-
SyncOnClose Yes -
-
-
SyncOnClose No -
-
Specifies whether the scheduler calls fsync(2) after writing configuration -or state files. The default is No. -
SystemGroup group-name [group-name ...]
diff --git a/doc/help/man-cupsaddsmb.html b/doc/help/man-cupsaddsmb.html index cc4e46e6c9..0bb0ddcd9a 100644 --- a/doc/help/man-cupsaddsmb.html +++ b/doc/help/man-cupsaddsmb.html @@ -162,6 +162,8 @@ Getting the full set of Windows driver files should be easier.

See Also

smbd(8), smb.conf(5), http://localhost:631/help +
+http://www.cups.org/windows/

Copyright

Copyright 2007-2013 by Apple Inc. diff --git a/doc/help/spec-ipp.html b/doc/help/spec-ipp.html index e06270c184..0a3228a6bd 100644 --- a/doc/help/spec-ipp.html +++ b/doc/help/spec-ipp.html @@ -12,7 +12,7 @@ CUPS IPP specification for CUPS. - Copyright 2007-2012 by Apple Inc. + Copyright 2007-2013 by Apple Inc. Copyright 1997-2007 by Easy Software Products. These coded instructions, statements, and computer programs are the @@ -2169,6 +2169,10 @@ document (fit-to-page=false). The default value is false.

The job-billing attribute provides a text value to associate with a job for billing purposes. +

job-cancel-after (integer(1:MAX))CUPS 2.0

+ +

The job-cancel-after attribute provides the maximum number of seconds that are allowed for processing a job.

+

job-hold-until (keyword | name(MAX))CUPS 1.1

The job-hold-until attribute specifies a hold time. In addition to the diff --git a/scheduler/job.c b/scheduler/job.c index d62fb2f407..66b7d21342 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -4480,6 +4480,10 @@ start_job(cupsd_job_t *job, /* I - Job ID */ cupsd_printer_t *printer) /* I - Printer to print job */ { const char *filename; /* Support filename */ + ipp_attribute_t *cancel_after = ippFindAttribute(job->attrs, + "job-cancel-after", + IPP_TAG_INTEGER); + /* job-cancel-after attribute */ cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job(job=%p(%d), printer=%p(%s))", @@ -4530,7 +4534,9 @@ start_job(cupsd_job_t *job, /* I - Job ID */ job->printer = printer; printer->job = job; - if (MaxJobTime > 0) + if (cancel_after) + job->cancel_time = time(NULL) + ippGetInteger(cancel_after, 0); + else if (MaxJobTime > 0) job->cancel_time = time(NULL) + MaxJobTime; else job->cancel_time = 0; @@ -4826,18 +4832,28 @@ update_job(cupsd_job_t *job) /* I - Job to check */ { event |= CUPSD_EVENT_PRINTER_STATE; - if (MaxJobTime > 0 && strstr(message, "connecting-to-device") != NULL) + if (MaxJobTime > 0) { /* * Reset cancel time after connecting to the device... */ + ipp_attribute_t *cancel_after = ippFindAttribute(job->attrs, + "job-cancel-after", + IPP_TAG_INTEGER); + /* job-cancel-after attribute */ + for (i = 0; i < job->printer->num_reasons; i ++) if (!strcmp(job->printer->reasons[i], "connecting-to-device")) break; if (i >= job->printer->num_reasons) - job->cancel_time = time(NULL) + MaxJobTime; + { + if (cancel_after) + job->cancel_time = time(NULL) + ippGetInteger(cancel_after, 0); + else + job->cancel_time = time(NULL) + MaxJobTime; + } } } diff --git a/scheduler/sysman.c b/scheduler/sysman.c index aaadbc405a..ead4801d75 100644 --- a/scheduler/sysman.c +++ b/scheduler/sysman.c @@ -957,6 +957,33 @@ sysUpdate(void) } #endif /* kIOPMAssertionTypeDenySystemSleep */ + /* + * Make sure jobs that were queued prior to the system going to sleep don't + * get canceled right away... + */ + + if (MaxJobTime > 0) + { + cupsd_job_t *job; /* Current job */ + + for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs); + job; + job = (cupsd_job_t *)cupsArrayNext(ActiveJobs)) + { + if (job->cancel_time) + { + ipp_attribute_t *cancel_after = ippFindAttribute(job->attrs, + "job-cancel-after", + IPP_TAG_INTEGER); + + if (cancel_after) + job->cancel_time = time(NULL) + ippGetInteger(cancel_after, 0); + else + job->cancel_time = time(NULL) + MaxJobTime; + } + } + } + cupsdCheckJobs(); }