Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

job-completed event has job-state 'job-printing' #1955

Closed
michaelrsweet opened this issue Sep 3, 2006 · 3 comments
Closed

job-completed event has job-state 'job-printing' #1955

michaelrsweet opened this issue Sep 3, 2006 · 3 comments

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.2-current
CUPS.org User: jlovell

The job-completed event has the job-state 'job-printing' rather than
'completed'. rfc3995, section 5.3.3.4.3 says:

job-completed':  REQUIRED - the job has reached one of the
         completed states, i.e., the value of the job's "job-state"
         attribute has changed to: 'completed', 'aborted', or
         'canceled'.

With a little testsubscriptions tool I see:

job-created: ("Job created.")
printer-state-changed: processing ("Printer "test" state changed.")
job-state: job-printing ("Job #38 started.")
job-completed: job-printing ("Job completed successfully.")
printer-state-changed: idle ("Printer "test" state changed.")

Seperatly, when a backend exits with an error the job-completed event is missing:

job-created: ("Job created.")
printer-state-changed: processing ("Printer "test" state changed.")
job-state: job-printing ("Job #39 started.")
printer-state-changed: stopped ("Printer "test" state changed.")

I hope to do more event testing on Tuesday...

Thanks!

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: jlovell

Got a little more testing in...

cupsdSetPrinterReasons() is not generating a printer-state-changed event.

Neither is accept/reject.

In printers.c maybe these two lines should be reversed so the reason is part of the printer-state-changed event:

      cupsdSetPrinterState(p, IPP_PRINTER_STOPPED, 0);
      cupsdSetPrinterReasons(p, "+cups-missing-filter-error");

And a similar construct in job.c:

  cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
                "Job canceled by "%s".", username);

  cupsdCancelJob(job, 0);

Thanks!

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

I think the attached patch should fix things up properly. Please let me know if you see any other issues...

@michaelrsweet
Copy link
Collaborator Author

"str1955.patch":

Index: ipp.c

--- ipp.c (revision 5931)
+++ ipp.c (working copy)
@@ -3048,9 +3048,6 @@

  • Cancel the job and return...
    */
  • cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,

- "Job canceled by "%s".", username);

cupsdCancelJob(job, 0);
cupsdCheckJobs();

Index: printers.c

--- printers.c (revision 5930)
+++ printers.c (working copy)
@@ -2897,9 +2897,8 @@
snprintf(p->state_message, sizeof(p->state_message),
"Filter "%s" for printer "%s" not available: %s",
program, p->name, strerror(errno));

  •  cupsdSetPrinterState(p, IPP_PRINTER_STOPPED, 0);
    

    cupsdSetPrinterReasons(p, "+cups-missing-filter-error");

  •  cupsdAddPrinterHistory(p);
    
  •  cupsdSetPrinterState(p, IPP_PRINTER_STOPPED, 0);
    

    cupsdLogMessage(CUPSD_LOG_ERROR, "%s", p->state_message);
    }

    Index: job.c

    --- job.c (revision 5936)
    +++ job.c (working copy)
    @@ -153,6 +153,7 @@
    {
    int i; /* Looping var /
    char filename[1024]; /
    Job filename */

  • cupsd_printer_t printer; / Printer used by job */

cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdCancelJob: id = %d", job->id);
@@ -161,6 +162,8 @@

  • Stop any processes that are working on the current job...
    */
  • printer = job->printer;

if (job->state_value == IPP_JOB_PROCESSING)
cupsdStopJob(job, 0);

@@ -173,6 +176,13 @@

set_time(job, "time-at-completed");

  • /*
  • * Send any pending notifications and then expire them...
  • */
  • cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, printer, job,

  •            purge ? "Job purged." : "Job canceled.");
    

    cupsdExpireSubscriptions(NULL, job);

    /*
    @@ -270,9 +280,6 @@

    • Cancel all jobs matching this destination/user...
      */
  •  cupsdAddEvent(CUPSD_EVENT_JOB_COMPLETED, job->printer, job,
    

- purge ? "Job purged." : "Job canceled.");

   cupsdCancelJob(job, purge);
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant