]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
<rdar://problem/13655599> Seed: Print queue JOBS disappear after computer Wakes up...
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 11 Sep 2013 17:45:56 +0000 (17:45 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Wed, 11 Sep 2013 17:45:56 +0000 (17:45 +0000)
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

doc/help/man-cups-files.conf.html
doc/help/man-cupsaddsmb.html
doc/help/spec-ipp.html
scheduler/job.c
scheduler/sysman.c

index 3e30a9d98d5a47b35105bae38aeeebf3db1e48e8..8c3a610fd4449f14da44aa49a4aeb4bf8571d828 100644 (file)
@@ -140,14 +140,6 @@ be found.
 <dd></dd>
 <dd>Specifies the directory where the server configuration files can be found.
 </dd>
-<dt>SyncOnClose Yes
-</dt>
-<dd></dd>
-<dt>SyncOnClose No
-</dt>
-<dd>Specifies whether the scheduler calls <i>fsync(2)</i> after writing configuration
-or state files. The default is No.
-</dd>
 <dt>SystemGroup group-name [group-name ...]
 </dt>
 <dd></dd>
index cc4e46e6c945360c4eb301504fe0de460eb7a3cf..0bb0ddcd9a8ae2f1a56e0dc61e2fabe621d27b9e 100644 (file)
@@ -162,6 +162,8 @@ Getting the full set of Windows driver files should be easier.
 <h2 class="title"><a name="SEE_ALSO">See Also</a></h2>
 <i>smbd(8)</i>, <i>smb.conf(5)</i>,
 <a href='http://localhost:631/help'>http://localhost:631/help</a>
+<br>
+<a href='http://www.cups.org/windows/'>http://www.cups.org/windows/</a>
 
 <h2 class="title"><a name="COPYRIGHT">Copyright</a></h2>
 Copyright 2007-2013 by Apple Inc.
index e06270c184d4ee7b8af14a88af16332469556103..0a3228a6bd8ad6d2e79a0438ffc9ff71a7992a65 100644 (file)
@@ -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.
 <p>The job-billing attribute provides a text value to associate with a job
 for billing purposes.
 
+<h4><a name="job-cancel-after">job-cancel-after (integer(1:MAX))</a><span class='info'>CUPS 2.0</span></h4>
+
+<p>The job-cancel-after attribute provides the maximum number of seconds that are allowed for processing a job.</p>
+
 <h4><a name="job-hold-until">job-hold-until (keyword | name(MAX))</a><span class='info'>CUPS 1.1</span></h4>
 
 <p>The job-hold-until attribute specifies a hold time. In addition to the
index d62fb2f407f146add938da5b896c75a79da230e6..66b7d21342900681709f3ce3ac4d5c648df0551b 100644 (file)
@@ -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;
+         }
         }
       }
 
index aaadbc405ad8f3414b39597f13b4357439e0396d..ead4801d752fbaa8d8985823d36f8c97bc451b0f 100644 (file)
@@ -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();
     }