[cups-devel] IPP requests: Non-blocking or short timeout
Michael Sweet
msweet at apple.com
Sun Sep 11 11:22:03 PDT 2016
Till,
> On Sep 11, 2016, at 9:45 AM, Till Kamppeter <till.kamppeter at gmail.com> wrote:
> ...
> If the CUPS on the server is not available for some reason (but the server itself is available), the cupsDoRequest() call hangs and takes more than a minute to time out. This also blocks the shutdown via SIGTERM of cups-browsed.
>
> What I would like to do is (preferably) reduce this timeout to something like 5 seconds. Is this possible?
The httpSetTimeout function can be used to manipulate the default read timeout for a given connection. But cupsDoRequest also attempts to reconnect on error (using a connection timeout of 30 seconds) so you might want to use cupsSendRequest and cupsGetResponse yourself to control the reconnect behavior...
> What I succeded is to replace httpConnectEncrypt() by my own with a 3 sec timeout, but this will probably only help on total absence of the server.
That takes care of the initial connection but not the subsequent re-connection...
> Or is the only way to use non-blocking mode? If so, is there somewhere sample code for doing such an IPP request non-blocking?
Non-blocking mode might help, but it should not be necessary for this situation. It sounds more like the remote server is going away but the reconnection is taking too long...
_________________________________________________________
Michael Sweet, Senior Printing System Engineer
More information about the cups
mailing list