rpms/cups/devel cups-BrowseInterval-fix.patch, NONE, 1.1 cups-IPP_MAX_VALUES.patch, NONE, 1.1 cups-rate-limit-SendBrowseList.patch, NONE, 1.1 cups.spec, 1.107, 1.108

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Sep 29 08:44:41 UTC 2005


Author: twaugh

Update of /cvs/dist/rpms/cups/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv23780

Modified Files:
	cups.spec 
Added Files:
	cups-BrowseInterval-fix.patch cups-IPP_MAX_VALUES.patch 
	cups-rate-limit-SendBrowseList.patch 
Log Message:
* Thu Sep 29 2005 Tim Waugh <twaugh at redhat.com> 1:1.1.23-18
- Raise IPP_MAX_VALUES to 100 (bug #164232).
- Made FindDest better behaved in some instances (bug #164232).
- Back-ported BrowseInterval fix from 1.1.23 (bug #164232).
- Rate limit SendBrowseList() calls (bug #164232).


cups-BrowseInterval-fix.patch:
 dirsvc.c   |   87 ++++++++++++++++++++++++++++++++++++++++---------------------
 dirsvc.h   |    2 +
 printers.c |   20 ++++++++++++++
 printers.h |    2 +
 4 files changed, 82 insertions(+), 29 deletions(-)

--- NEW FILE cups-BrowseInterval-fix.patch ---
--- cups-1.1.17/scheduler/dirsvc.c.BrowseInterval-fix	2005-09-28 10:12:23.000000000 +0100
+++ cups-1.1.17/scheduler/dirsvc.c	2005-09-28 10:15:39.000000000 +0100
@@ -516,20 +516,64 @@
 
   if (BrowseInterval > 0)
   {
-    for (count = 0, p = Printers; p != NULL; p = p->next)
+    int	max_count;			/* Maximum number to update */
+
+   /*
+    * Throttle the number of printers we'll be updating this time
+    * around based on the number of queues that need updating and
+    * the maximum number of queues to update each second...
+    */
+
+    max_count = 2 * NumPrinters / BrowseInterval + 1;
+
+    for (count = 0, p = Printers; count < max_count && p != NULL; p = p->next)
       if (!(p->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) &&
           p->browse_time < ut)
         count ++;
 
    /*
-    * Throttle the number of printers we'll be updating this time
-    * around...
+    * Loop through all of the printers and send local updates as needed...
     */
 
-    count = 2 * count / BrowseInterval + 1;
+    for (p = BrowseNext; count > 0; p = p->next)
+    {
+     /*
+      * Check for wraparound...
+      */
+
+      if (!p)
+        p = Printers;
+
+      if (!p)
+        break;
+      else if (p->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT))
+        continue;
+      else if (p->browse_time < ut)
+      {
+       /*
+	* Need to send an update...
+	*/
+
+	count --;
+
+	p->browse_time = time(NULL);
+
+	if (BrowseProtocols & BROWSE_CUPS)
+          SendCUPSBrowse(p);
+
+#ifdef HAVE_LIBSLP
+	if (BrowseProtocols & BROWSE_SLP)
+          SendSLPBrowse(p);
+#endif /* HAVE_LIBSLP */
+      }
+    }
+
+   /*
+    * Save where we left off so that all printers get updated...
+    */
+
+    BrowseNext = p;
   }
-  else
-    count = 0;
 
  /*
   * Loop through all of the printers and send local updates as needed...
@@ -537,14 +581,18 @@
 
   for (p = Printers; p != NULL; p = np)
   {
+   /*
+    * Save the next printer pointer...
+    */
+
     np = p->next;
 
+   /*
+    * If this is a remote queue, see if it needs to be timed out...
+    */
+
     if (p->type & CUPS_PRINTER_REMOTE)
     {
-     /*
-      * See if this printer needs to be timed out...
-      */
-
       if (p->browse_time < to)
       {
         LogMessage(L_INFO, "Remote destination \"%s\" has timed out; deleting it...",
@@ -552,25 +600,6 @@
         DeletePrinter(p);
       }
     }
-    else if (p->browse_time < ut && count > 0 &&
-             !(p->type & CUPS_PRINTER_IMPLICIT))
-    {
-     /*
-      * Need to send an update...
-      */
-
-      count --;
-
-      p->browse_time = time(NULL);
-
-      if (BrowseProtocols & BROWSE_CUPS)
-        SendCUPSBrowse(p);
-
-#ifdef HAVE_LIBSLP
-      if (BrowseProtocols & BROWSE_SLP)
-        SendSLPBrowse(p);
-#endif /* HAVE_LIBSLP */
-    }
   }
 }
 
--- cups-1.1.17/scheduler/printers.h.BrowseInterval-fix	2005-09-28 10:20:08.000000000 +0100
+++ cups-1.1.17/scheduler/printers.h	2005-09-28 10:21:00.000000000 +0100
@@ -80,6 +80,8 @@
  * Globals...
  */
 
+VAR int			NumPrinters	VALUE(0);
+					/* Number of printers */
 VAR printer_t		*Printers VALUE(NULL);	/* Printer list */
 VAR printer_t		*DefaultPrinter VALUE(NULL);
 						/* Default printer */
--- cups-1.1.17/scheduler/printers.c.BrowseInterval-fix	2005-09-28 10:21:31.000000000 +0100
+++ cups-1.1.17/scheduler/printers.c	2005-09-28 10:26:56.000000000 +0100
@@ -134,6 +134,12 @@
 
   WritePrintcap();
 
+ /*
+  * Bump the printer count and return...
+  */
+
+  NumPrinters ++;
+
   return (p);
 }
 
@@ -290,6 +296,8 @@
   else
     prev->next = p->next;
 
+  NumPrinters --;
+
  /*
   * Stop printing on this printer...
   */
@@ -297,6 +305,13 @@
   StopPrinter(p);
 
  /*
+  * If this printer is the next for browsing, point to the next one...
+  */
+
+  if (p == BrowseNext)
+    BrowseNext = p->next;
+
+ /*
   * Remove the dummy interface/icon/option files under IRIX...
   */
 
@@ -1470,6 +1485,11 @@
 
   if (old_state != s)
   {
+   /*
+    * Let the browse code know this needs to be updated...
+    */
+
+    BrowseNext     = p;
     p->browse_time = 0;
 
 #ifdef __sgi
--- cups-1.1.17/scheduler/dirsvc.h.BrowseInterval-fix	2005-09-28 10:24:16.000000000 +0100
+++ cups-1.1.17/scheduler/dirsvc.h	2005-09-28 10:25:05.000000000 +0100
@@ -100,6 +100,8 @@
 					/* Broadcast addresses */
 VAR location_t		*BrowseACL	VALUE(NULL);
 					/* Browser access control list */
+VAR printer_t		*BrowseNext	VALUE(NULL);
+					/* Next class/printer to broadcast */
 VAR int			NumRelays	VALUE(0);
 					/* Number of broadcast relays */
 VAR dirsvc_relay_t	Relays[MAX_BROWSERS];

cups-IPP_MAX_VALUES.patch:
 ipp.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE cups-IPP_MAX_VALUES.patch ---
--- cups-1.1.17/cups/ipp.h.IPP_MAX_VALUES	2005-09-28 18:53:49.000000000 +0100
+++ cups-1.1.17/cups/ipp.h	2005-09-28 18:53:55.000000000 +0100
@@ -63,7 +63,7 @@
  */
 
 #  define IPP_MAX_NAME		256
-#  define IPP_MAX_VALUES	10	/* Now just an allocation increment */
+#  define IPP_MAX_VALUES	100	/* Now just an allocation increment */
 
 
 /*

cups-rate-limit-SendBrowseList.patch:
 main.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletion(-)

--- NEW FILE cups-rate-limit-SendBrowseList.patch ---
--- cups-1.1.17/scheduler/main.c.rate-limit-SendBrowseList	2005-09-27 18:53:51.000000000 +0100
+++ cups-1.1.17/scheduler/main.c	2005-09-27 18:53:52.000000000 +0100
@@ -83,6 +83,7 @@
 			*next;		/* Next job */
   listener_t		*lis;		/* Current listener */
   time_t		activity;	/* Activity timer */
+  time_t		browse_time;	/* Next browse send time */
   time_t		senddoc_time;	/* Send-Document time */
 #ifdef HAVE_MALLINFO
   time_t		mallinfo_time;	/* Malloc information time */
@@ -383,6 +384,7 @@
   * Loop forever...
   */
 
+  browse_time   = time(NULL);
   senddoc_time = time(NULL);
 
 #ifdef HAVE_MALLINFO
@@ -611,7 +613,11 @@
         UpdateSLPBrowse();
 #endif /* HAVE_LIBSLP */
 
-      SendBrowseList();
+      if (time(NULL) > browse_time)
+      {
+	SendBrowseList();
+	browse_time = time(NULL);
+      }
     }
 
    /*


Index: cups.spec
===================================================================
RCS file: /cvs/dist/rpms/cups/devel/cups.spec,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -r1.107 -r1.108
--- cups.spec	28 Sep 2005 15:20:06 -0000	1.107
+++ cups.spec	29 Sep 2005 08:44:38 -0000	1.108
@@ -49,8 +49,11 @@
 Patch32: cups-pid.patch
 Patch33: cups-CAN-2004-0888.patch
 Patch34: cups-CAN-2005-2097.patch
-Patch35: cups-finddest.patch
-Patch36: cups-dbus.patch
+Patch35: cups-rate-limit-SendBrowseList.patch
+Patch36: cups-BrowseInterval-fix.patch
+Patch37: cups-finddest.patch
+Patch38: cups-IPP_MAX_VALUES.patch
+Patch39: cups-dbus.patch
 Epoch: 1
 Url: http://www.cups.org/
 BuildRoot: %{_tmppath}/%{name}-root
@@ -144,9 +147,12 @@
 %patch32 -p1 -b .pid
 %patch33 -p1 -b .CAN-2004-0888
 %patch34 -p1 -b .CAN-2005-2097
-%patch35 -p1 -b .finddest
+%patch35 -p1 -b .rate-limit-SendBrowseList
+%patch36 -p1 -b .BrowseInterval-fix
+%patch37 -p1 -b .finddest
+%patch38 -p1 -b .BrowseInterval-fix
 %if %use_dbus
-%patch36 -p1 -b .dbus
+%patch39 -p1 -b .dbus
 %endif
 perl -pi -e 's,^#(Printcap\s+/etc/printcap),$1,' conf/cupsd.conf.in
 aclocal -I config-scripts
@@ -411,8 +417,11 @@
 %{_libdir}/cups/daemon/cups-lpd
 
 %changelog
-* Wed Sep 28 2005 Tim Waugh <twaugh at redhat.com> 1:1.1.23-18
-- Added finddest patch for better scaling (bug #164232).
+* Thu Sep 29 2005 Tim Waugh <twaugh at redhat.com> 1:1.1.23-18
+- Raise IPP_MAX_VALUES to 100 (bug #164232).
+- Made FindDest better behaved in some instances (bug #164232).
+- Back-ported BrowseInterval fix from 1.1.23 (bug #164232).
+- Rate limit SendBrowseList() calls (bug #164232).
 
 * Fri Sep  2 2005 Tim Waugh <twaugh at redhat.com> 1:1.1.23-17
 - Fixed CAN-2005-2097 (bug #164510).




More information about the fedora-cvs-commits mailing list