Skip to content

Commit

Permalink
scheduler: Clean up failed IPP Everywhere permanent queues
Browse files Browse the repository at this point in the history
If creating of permanent queue with IPP Everywhere model fails in separate thread, the print queue is created as raw.

It would be great if we remove such queue if creation fails, and marking them as temporary would make them to be removed automatically.
  • Loading branch information
zdohnal authored Dec 2, 2024
2 parents a021fbe + 1370233 commit 04625d9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scheduler/ipp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5226,6 +5226,7 @@ create_local_bg_thread(
/* Force printer to timeout and be deleted */
cupsRWLockWrite(&printer->lock);
printer->state_time = 0;
printer->temporary = 1;
cupsRWUnlock(&printer->lock);

send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Couldn't resolve mDNS URI \"%s\"."), printer->device_uri);
Expand All @@ -5246,6 +5247,7 @@ create_local_bg_thread(
/* Force printer to timeout and be deleted */
cupsRWLockWrite(&printer->lock);
printer->state_time = 0;
printer->temporary = 1;
cupsRWUnlock(&printer->lock);

send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Unable to connect to %s:%d: %s"), host, port, cupsGetErrorString());
Expand Down Expand Up @@ -5330,6 +5332,7 @@ create_local_bg_thread(
/* Force printer to timeout and be deleted */
cupsRWLockWrite(&printer->lock);
printer->state_time = 0;
printer->temporary = 1;
cupsRWUnlock(&printer->lock);

send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("The printer does not provide attributes required for IPP Everywhere."));
Expand All @@ -5339,6 +5342,12 @@ create_local_bg_thread(
// Validate response from printer...
if (!ippValidateAttributes(response))
{
/* Force printer to timeout and be deleted */
cupsRWLockWrite(&printer->lock);
printer->state_time = 0;
printer->temporary = 1;
cupsRWUnlock(&printer->lock);

send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Printer returned invalid data: %s"), cupsGetErrorString());
goto finish_response;
}
Expand Down Expand Up @@ -5387,6 +5396,7 @@ create_local_bg_thread(
/* Force printer to timeout and be deleted */
cupsRWLockWrite(&printer->lock);
printer->state_time = 0;
printer->temporary = 1;
cupsRWUnlock(&printer->lock);

send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Unable to create PPD for printer: %s"), strerror(errno));
Expand Down Expand Up @@ -5420,6 +5430,7 @@ create_local_bg_thread(
/* Force printer to timeout and be deleted */
cupsRWLockWrite(&printer->lock);
printer->state_time = 0;
printer->temporary = 1;
cupsRWUnlock(&printer->lock);

send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Unable to create PPD: %s"), cupsGetErrorString());
Expand Down

0 comments on commit 04625d9

Please sign in to comment.