]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Don't send device updates all at once. Instead, limit them to 1 per second
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sun, 5 Oct 2008 16:54:25 +0000 (16:54 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sun, 5 Oct 2008 16:54:25 +0000 (16:54 +0000)
since otherwise some browsers crash trying to keep up...

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@8014 7a7537e8-13f0-0310-91df-b6672ffda945

cgi-bin/admin.c

index 982fa1bd28df6e76e1ba9a67a13ed0e15666f1c1..ff0695762bda3f0b2bb94d5068ee26ef337a5e83 100644 (file)
@@ -53,7 +53,8 @@
  * Local globals...
  */
 
-static int     current_device = 0;
+static int     current_device;         /* Current device for add/modify */
+static time_t  last_device_time;       /* Last update time for device list */
 
 
 /*
@@ -277,14 +278,19 @@ choose_device_cb(
 
   current_device ++;
 
- /*
-  * Update the page...
-  */
+  if (time(NULL) > last_device_time)
+  {
+   /*
+    * Update the page...
+    */
 
-  cgiStartHTML(title);
-  cgiCopyTemplateLang("choose-device.tmpl");
-  cgiEndHTML();
-  fflush(stdout);
+    cgiStartHTML(title);
+    cgiCopyTemplateLang("choose-device.tmpl");
+    cgiEndHTML();
+    fflush(stdout);
+
+    time(&last_device_time);
+  }
 }
 
 
@@ -934,6 +940,7 @@ do_am_printer(http_t *http,         /* I - HTTP connection */
 
     fputs("DEBUG: Getting list of devices...\n", stderr);
 
+    time(&last_device_time);
     current_device = 0;
     if (cupsGetDevices(http, 30, NULL, (cups_device_cb_t)choose_device_cb,
                        (void *)title) == IPP_OK)