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 committed Dec 2, 2024
1 parent 5cc470c commit 2e3f158
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scheduler/ipp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5294,6 +5294,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 @@ -5314,6 +5315,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, _("Bad device URI \"%s\"."), device_uri);
Expand All @@ -5332,6 +5334,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, cupsLastErrorString());
Expand Down Expand Up @@ -5420,6 +5423,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"), cupsLastErrorString());
goto finish_response;
}
Expand Down Expand Up @@ -5453,6 +5462,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 read generated PPD: %s"), strerror(errno));
Expand All @@ -5468,6 +5478,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 @@ -5501,6 +5512,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"), cupsLastErrorString());
Expand Down

0 comments on commit 2e3f158

Please sign in to comment.