/*
* "$Id: job.c 7902 2008-09-03 14:20:17Z mike $"
*
- * Job management routines for the Common UNIX Printing System (CUPS).
+ * Job management routines for the CUPS scheduler.
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
if (job->kill_time && job->kill_time <= curtime)
{
+ cupsdLogMessage(CUPSD_LOG_ERROR, "[Job %d] Stopping unresponsive job!",
+ job->id);
+
stop_job(job, CUPSD_JOB_FORCE);
continue;
}
*/
if (job->state_value == IPP_JOB_PENDING && !NeedReload && !Sleeping &&
- !job->printer)
+ !DoingShutdown && !job->printer)
{
printer = cupsdFindDest(job->dest);
pclass = NULL;
cupsdDestroyProfile(job->profile);
job->profile = NULL;
+ /*
+ * Clear the unresponsive job watchdog timer...
+ */
+
+ job->kill_time = 0;
+
/*
* Close pipes and status buffer...
*/
job->tries ++;
- if (job->tries >= JobRetryLimit)
+ if (job->tries > JobRetryLimit && JobRetryLimit > 0)
{
/*
* Too many tries...
num_pwgppds = 0;
pwgppds = NULL;
- if (pwg)
+ if (pwg &&
+ !ippFindAttribute(job->attrs,
+ "com.apple.print.DocumentTicket.PMSpoolFormat",
+ IPP_TAG_ZERO) &&
+ (ippFindAttribute(job->attrs, "output-mode", IPP_TAG_ZERO) ||
+ ippFindAttribute(job->attrs, "print-quality", IPP_TAG_ZERO)))
{
+ /*
+ * Map output-mode and print-quality to a preset...
+ */
+
if ((attr = ippFindAttribute(job->attrs, "output-mode",
IPP_TAG_KEYWORD)) != NULL &&
!strcmp(attr->values[0].string.text, "monochrome"))
output_mode = _PWG_OUTPUT_MODE_COLOR;
if ((attr = ippFindAttribute(job->attrs, "print-quality",
- IPP_TAG_INTEGER)) != NULL &&
+ IPP_TAG_ENUM)) != NULL &&
attr->values[0].integer >= IPP_QUALITY_DRAFT &&
attr->values[0].integer <= IPP_QUALITY_HIGH)
print_quality = attr->values[0].integer - IPP_QUALITY_DRAFT;
else
- print_quality = IPP_QUALITY_NORMAL;
+ print_quality = _PWG_PRINT_QUALITY_NORMAL;
if (pwg->num_presets[output_mode][print_quality] == 0)
{
&pwgppds);
}
}
+ }
+ if (pwg)
+ {
if (pwg->sides_option &&
!ippFindAttribute(job->attrs, pwg->sides_option, IPP_TAG_ZERO) &&
(attr = ippFindAttribute(job->attrs, "sides", IPP_TAG_KEYWORD)) != NULL)
if (!ippFindAttribute(job->attrs, "PageRegion", IPP_TAG_ZERO) &&
!ippFindAttribute(job->attrs, "PageSize", IPP_TAG_ZERO) &&
(ppd = _pwgGetPageSize(pwg, job->attrs, NULL, &exact)) != NULL)
+ {
num_pwgppds = cupsAddOption("PageSize", ppd, num_pwgppds, &pwgppds);
+ if (!ippFindAttribute(job->attrs, "media", IPP_TAG_ZERO))
+ num_pwgppds = cupsAddOption("media", ppd, num_pwgppds, &pwgppds);
+ }
+
if (!ippFindAttribute(job->attrs, "OutputBin", IPP_TAG_ZERO) &&
(attr = ippFindAttribute(job->attrs, "output-bin",
IPP_TAG_ZERO)) != NULL &&
event |= CUPSD_EVENT_PRINTER_STATE | CUPSD_EVENT_JOB_PROGRESS;
- if (loglevel < job->status_level)
+ if (loglevel <= job->status_level && job->status_level > CUPSD_LOG_ERROR)
{
/*
* Some messages show in the job-printer-state-message attribute...