[cups-devel] IPP requests: Non-blocking or short timeout
Till Kamppeter
till.kamppeter at gmail.com
Mon Sep 12 15:33:05 PDT 2016
On 09/11/2016 03:22 PM, Michael Sweet wrote:
>
> The httpSetTimeout function can be used to manipulate the default read timeout for a given connection.
I have successfully applied this function now. I found out that it
requires a callback which tell by its return value whether to stop. I
have reduced all timeouts to 3 seconds now. This even works with
cupsDoRequest, so I did not even need to separate cupsSendRequest and
cupsGetResponse. cupsDoRequest also has quit after 3 seconds this way.
I also reduced the timeout of the creation of HTTP connections to 3
seconds by calling httpConnect2() directly.
In addition I followed all g_main_loop_quit(gmainloop) calls with a
g_main_context_wakeup(NULL) call, to make sure that the main loop gets
quit as quick as possible.
This reduces the delay of cups-browsed shutdown when it has problems to
access certain CUPS servers, but it does not reduce it to 3 seconds. In
some cases it can even still hang for a minute or so.
Any hints for further improvement here?
A possible cause for the hangs was also that the implicitclass backend
was bombing cups-browsed with requests as I exited it with
CUPS_BACKEND_RETRY_CURRENT instead of CUPS_BACKEND_RETRY when it was not
able to send the job off to the remote server. This way the job was
tried again immediately and not after a delay.
Thank you very much for the help.
Till
More information about the cups-devel
mailing list