[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#794655: cups-browsed: please make the browse interval to be configurable



Hi,

On 3 October 2016 at 17:33, Till Kamppeter <till.kamppeter@gmail.com> wrote:
> Sorry for not having seen this mail in the first place.
>
> There are two parameters: BrowseInterval (currently 60 sec) and
> BrowseTimeout (currently 300 sec). Both were configurable in CUPS (< 1.6)
> and are hardcoded in cups-browsed. It is a good idea to make them
> configurable and it should be easy to do so.
>
> As I have done a lot of changes on cups-browsed in the last few weeks I
> would ask you to attach an updated patch to allow for configuring the two
> parameters at run time (e. g. via cups-browsed.conf).

No problem, attached patch should do it.

Bonus points wrt the original patch: BrowseTimeout can be configured,
example and default values are included in the.conf file, and both
directives are documented in .conf's manpage.

Cheers,
-- 
Raphael Geissert - Debian Developer
www.debian.org - get.debian.net
Index: cups-filters-1.11.4/utils/cups-browsed.c
===================================================================
--- cups-filters-1.11.4.orig/utils/cups-browsed.c	2016-10-04 12:06:14.000000000 +0200
+++ cups-filters-1.11.4/utils/cups-browsed.c	2016-10-04 12:10:42.050671162 +0200
@@ -6262,6 +6262,19 @@ read_configuration (const char *filename
 	  regfree(filter->cregexp);
 	free(filter);
       }
+    } else if ((!strcasecmp(line, "BrowseInterval") || !strcasecmp(line, "BrowseTimeout")) && value) {
+      int t = atoi(value);
+      if (t >= 0) {
+	if (!strcasecmp(line, "BrowseInterval"))
+	  BrowseInterval = t;
+	else if (!strcasecmp(line, "BrowseTimeout"))
+	  BrowseInterval = 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, "DomainSocket") && value) {
       if (value[0] != '\0')
 	DomainSocket = strdup(value);
Index: cups-filters-1.11.4/utils/cups-browsed.conf.in
===================================================================
--- cups-filters-1.11.4.orig/utils/cups-browsed.conf.in	2016-10-04 12:06:14.000000000 +0200
+++ cups-filters-1.11.4/utils/cups-browsed.conf.in	2016-10-04 12:10:42.050671162 +0200
@@ -105,6 +105,19 @@ BrowseRemoteProtocols @BROWSEREMOTEPROTO
 # BrowseOrder Allow,Deny
 
 
+# The interval between browsing cycles, local and/or remote, can be
+# adjusted with the BrowseInterval directive.
+
+# BrowseInterval 60
+
+
+# Browsing-related operations such as adding or removing printer queues
+# and broadcasting are each allowed to take up to a given amount of time.
+# It can be configured, in seconds, with the BrowseTimeout directive.
+
+# BrowseTimeout 300
+
+
 # Filtering of remote printers by other properties than IP addresses
 # of their servers
 
Index: cups-filters-1.11.4/utils/cups-browsed.conf.5
===================================================================
--- cups-filters-1.11.4.orig/utils/cups-browsed.conf.5	2016-10-04 12:06:14.000000000 +0200
+++ cups-filters-1.11.4/utils/cups-browsed.conf.5	2016-10-04 12:11:17.921994453 +0200
@@ -416,6 +416,26 @@ or "Off" lets cups-browsed not use CUPS'
 
 .fam T
 .fi
+The BrowseInterval directive specifies the interval between local and/or
+remote browsing cycles in seconds.
+.PP
+.nf
+.fam C
+        BrowseInterval 60
+
+.fam T
+.fi
+The BrowseTimeout directive determines the amount of time that
+browsing-related operations are allowed to take in seconds.
+Notably, adding or removing one printer queue is considered as one
+operation. The timeout applies to each one of those operations.
+.PP
+.nf
+.fam C
+        BrowseTimeout 300
+
+.fam T
+.fi
 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 problems with

Reply to: