Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of failures when creating local print queues
When the function create_queue() fails to create a local print queue and the failure is not intermittent, it sets a global variable so that the loop for updating the local print queues for all entries in the list of discovered remote printers gets stopped and the failing entry removed from the list of discovered remote printers. There were two problems with this variable: - Once the loop stopped, the variable did not get reset, preventing any further updating of the local print queues during the rest of the life of the daemon. With the print queues not being updated, the entries in the remote printer list for which an update is due, stay in that state, making update_cups_queues() being called again immediately, not updating the queues again, ending up in a busy loop, making the daemon run on 100% CPU for the rest of its life. - create_queue() is running in a background thread, asynchronously, meaning that when it sets the global variable on a failure, the loop in update_cups_queues() can already have advanced by some list entries when it gets stopped, and so the wrong entry gets removed. Therefore we do away completely with this global variable and simply mark the failing printer list entry as disappeared so that in the next run of update_cups_queues() it gets removed.
- Loading branch information