OpenPrinting / ippusbxd

Cross-platform IPP over USB driver
Other
29 stars 4 forks source link

Adding exponential backoff for print read requests #6

Closed DavieV closed 5 years ago

DavieV commented 5 years ago

Initiating read requests uses an asynchronous callback system where requests are sent to the printer and then a callback will fire with the printer's response. If the printer currently has no data to service the read request then it responds with a 0-byte message. This system lead to ippusbxd spamming the printer continuously with read requests that came back with empty responses.

This change introduces exponential backoff so that if an empty response is received from the printer, ippusbxd will wait for increasingly long periods before issuing another request. This change significantly reduces syslog spam, and should result in faster communication with the printer.