Compare commits

...

2 Commits
master ... f26

Author SHA1 Message Date
Zdenek Dohnal 9e0a7b0c23 rebuilt for qpdf-7.1.1 2018-04-19 11:58:29 +02:00
Zdenek Dohnal 12a91c59ae 1487873 - cups-browsed and cups in endless updating loop 2018-03-06 08:30:55 +01:00
2 changed files with 146 additions and 1 deletions

137
cups-filters-timeouts.patch Normal file
View File

@ -0,0 +1,137 @@
diff -up cups-filters-1.13.4/utils/cups-browsed.c.httptimeouts cups-filters-1.13.4/utils/cups-browsed.c
--- cups-filters-1.13.4/utils/cups-browsed.c.httptimeouts 2018-03-05 20:09:53.596815387 +0100
+++ cups-filters-1.13.4/utils/cups-browsed.c 2018-03-05 20:27:17.625885188 +0100
@@ -351,6 +351,8 @@ static size_t NumBrowsePoll = 0;
static guint update_netifs_sourceid = 0;
static char local_server_str[1024];
static char *DomainSocket = NULL;
+static unsigned int HttpLocalTimeout = 5;
+static unsigned int HttpRemoteTimeout = 10;
static ip_based_uris_t IPBasedDeviceURIs = IP_BASED_URIS_NO;
static unsigned int CreateRemoteRawPrinterQueues = 0;
static unsigned int CreateRemoteCUPSPrinterQueues = 1;
@@ -587,6 +589,7 @@ httpConnectEncryptShortTimeout(const cha
int
http_timeout_cb(http_t *http, void *user_data)
{
+ debug_printf("HTTP timeout! (consider increasing HttpLocalTimeout/HttpRemoteTimeout value)\n");
return 0;
}
@@ -599,7 +602,7 @@ http_connect_local (void)
cupsEncryption());
}
if (local_conn)
- httpSetTimeout(local_conn, 3, http_timeout_cb, NULL);
+ httpSetTimeout(local_conn, HttpLocalTimeout, http_timeout_cb, NULL);
else
debug_printf("cups-browsed: Failed creating http connection to local CUPS daemon: %s:%d\n", cupsServer(), ippPort());
@@ -2631,7 +2634,7 @@ on_printer_state_changed (CupsNotifier *
p->port);
if (http) {
/* Check whether the printer is idle, processing, or disabled */
- httpSetTimeout(http, 2, http_timeout_cb, NULL);
+ httpSetTimeout(http, HttpRemoteTimeout, http_timeout_cb, NULL);
request = ippNewRequest(CUPS_GET_PRINTERS);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
@@ -3690,7 +3693,7 @@ gboolean handle_cups_queues(gpointer unu
p->timeout = current_time + TIMEOUT_RETRY;
break;
}
- httpSetTimeout(http, 3, http_timeout_cb, NULL);
+ httpSetTimeout(http, HttpLocalTimeout, http_timeout_cb, NULL);
/* Do not auto-save option settings due to the print queue creation
process */
@@ -3743,7 +3746,7 @@ gboolean handle_cups_queues(gpointer unu
p->no_autosave = 0;
break;
}
- httpSetTimeout(remote_http, 3, http_timeout_cb, NULL);
+ httpSetTimeout(remote_http, HttpRemoteTimeout, http_timeout_cb, NULL);
if ((loadedppd = cupsGetPPD2(remote_http, p->name)) == NULL &&
CreateRemoteRawPrinterQueues == 0) {
debug_printf("Unable to load PPD file for %s from the server %s:%d!\n",
@@ -5772,7 +5775,7 @@ browse_poll_cancel_subscription (browsep
return;
}
- httpSetTimeout(conn, 3, http_timeout_cb, NULL);
+ httpSetTimeout(conn, HttpRemoteTimeout, http_timeout_cb, NULL);
debug_printf ("cups-browsed [BrowsePoll %s:%d]: IPP-Cancel-Subscription\n",
context->server, context->port);
@@ -5914,7 +5917,7 @@ browse_poll (gpointer data)
goto fail;
}
- httpSetTimeout(conn, 3, http_timeout_cb, NULL);
+ httpSetTimeout(conn, HttpRemoteTimeout, http_timeout_cb, NULL);
if (context->can_subscribe) {
if (context->subscription_id == -1) {
@@ -6430,6 +6433,19 @@ read_configuration (const char *filename
} else if (!strcasecmp(line, "DomainSocket") && value) {
if (value[0] != '\0')
DomainSocket = strdup(value);
+ } else if ((!strcasecmp(line, "HttpLocalTimeout") || !strcasecmp(line, "HttpRemoteTimeout")) && value) {
+ int t = atoi(value);
+ if (t >= 0) {
+ if (!strcasecmp(line, "HttpLocalTimeout"))
+ HttpLocalTimeout = t;
+ else if (!strcasecmp(line, "HttpRemoteTimeout"))
+ HttpRemoteTimeout = t;
+
+ debug_printf("Set %s to %d sec.\n",
+ line, t);
+ } else
+ debug_printf("Invalid %s value: %d\n",
+ line, t);
} else if (!strcasecmp(line, "IPBasedDeviceURIs") && value) {
if (!strcasecmp(value, "IPv4") || !strcasecmp(value, "IPv4Only"))
IPBasedDeviceURIs = IP_BASED_URIS_IPV4_ONLY;
diff -up cups-filters-1.13.4/utils/cups-browsed.conf.5.httptimeouts cups-filters-1.13.4/utils/cups-browsed.conf.5
--- cups-filters-1.13.4/utils/cups-browsed.conf.5.httptimeouts 2018-03-05 20:10:00.042761769 +0100
+++ cups-filters-1.13.4/utils/cups-browsed.conf.5 2018-03-05 20:13:23.417070065 +0100
@@ -416,6 +416,19 @@ or "Off" lets cups-browsed not use CUPS'
.fam T
.fi
+Set HTTP timeout (in seconds) for requests sent to local/remote
+resources Note that too short timeouts can make services getting
+missed when they are present and operations be unneccesarily
+repeated and too long timeouts can make operations take too long
+when the server does not respond.
+.PP
+.nf
+.fam C
+ HttpLocalTimeout 5
+ HttpRemoteTimeout 10
+
+.fam T
+.fi
The interval between browsing/broadcasting cycles, local and/or
remote, can be adjusted with the BrowseInterval directive.
.PP
diff -up cups-filters-1.13.4/utils/cups-browsed.conf.in.httptimeouts cups-filters-1.13.4/utils/cups-browsed.conf.in
--- cups-filters-1.13.4/utils/cups-browsed.conf.in.httptimeouts 2018-03-05 20:10:05.452716768 +0100
+++ cups-filters-1.13.4/utils/cups-browsed.conf.in 2018-03-05 20:11:51.917831172 +0100
@@ -301,6 +301,16 @@ BrowseRemoteProtocols @BROWSEREMOTEPROTO
# DomainSocket Off
+# Set HTTP timeout (in seconds) for requests sent to local/remote
+# resources Note that too short timeouts can make services getting
+# missed when they are present and operations be unneccesarily
+# repeated and too long timeouts can make operations take too long
+# when the server does not respond.
+
+# HttpLocalTimeout 5
+# HttpRemoteTimeout 10
+
+
# Set IPBasedDeviceURIs to "Yes" if cups-browsed should create its
# local queues with device URIs with the IP addresses instead of the
# host names of the remote servers. This mode is there for any

View File

@ -4,7 +4,7 @@
Summary: OpenPrinting CUPS filters and backends
Name: cups-filters
Version: 1.13.4
Release: 3%{?dist}
Release: 5%{?dist}
# For a breakdown of the licensing, see COPYING file
# GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*,
@ -21,6 +21,7 @@ Url: http://www.linuxfoundation.org/collaborate/workgroups/openprinting/cups
Source0: http://www.openprinting.org/download/cups-filters/cups-filters-%{version}.tar.xz
Patch01: cups-filters-apremotequeueid.patch
Patch02: cups-filters-timeouts.patch
Requires: cups-filters-libs%{?_isa} = %{version}-%{release}
@ -116,6 +117,7 @@ This is the development package for OpenPrinting CUPS filters and backends.
%prep
%setup -q
%patch01 -p1 -b .apremotequeueid
%patch02 -p1 -b .timeouts
%build
# work-around Rpath
@ -279,6 +281,12 @@ fi
%{_libdir}/libfontembed.so
%changelog
* Wed Apr 18 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.13.4-5
- rebuilt for qpdf-7.1.1
* Mon Mar 05 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.13.4-4
- 1487873 - cups-browsed and cups in endless updating loop
* Thu Aug 10 2017 Zdenek Dohnal <zdohnal@redhat.com> - 1.13.4-3
- rebuilt for qpdf-libs