]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The scheduler would restart continuously when idle and printers were not
authorMichael R Sweet <michael.r.sweet@gmail.com>
Tue, 16 Jul 2019 13:07:17 +0000 (09:07 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Tue, 16 Jul 2019 13:07:17 +0000 (09:07 -0400)
shared (rdar://52561199)

CHANGES.md
scheduler/main.c

index c1211534b66251af03279e608c6d1230dd98be4a..58db8c21696e95b4bb8f587c4e0dce5aa23555d3 100644 (file)
@@ -1,4 +1,4 @@
-CHANGES - 2.3.0 - 2019-06-17
+CHANGES - 2.3.0 - 2019-07-16
 ============================
 
 
@@ -13,6 +13,8 @@ Changes in CUPS v2.3.0
 - Fixed a NULL pointer dereference bug in `httpGetSubField2` (Issue #5598)
 - Fixed an issue with unsupported "sides" values in the IPP backend
   (rdar://51775322)
+- The scheduler would restart continuously when idle and printers were not
+  shared (rdar://52561199)
 - Fixed an issue with `EXPECT !name WITH-VALUE ...` tests.
 - Fixed a command ordering issue in the Zebra ZPL driver.
 
index 3a2fe7ec90bc8e02223660de6cd0f506e3fd089a..842b00a42d2e890ca737ec85cd668a80499103f8 100644 (file)
@@ -756,7 +756,10 @@ main(int  argc,                            /* I - Number of command-line args */
 
 #ifdef HAVE_ONDEMAND
        if (OnDemand)
+       {
+         stop_scheduler = 1;
          break;
+       }
 #endif /* HAVE_ONDEMAND */
 
         DoingShutdown = 1;
@@ -2048,13 +2051,31 @@ service_checkout(int shutdown)          /* I - Shutting down? */
 #ifdef HAVE_ONDEMAND
   if (OnDemand)
   {
+    int shared_printers = 0;           /* Do we have shared printers? */
+
     strlcpy(pidfile, CUPS_KEEPALIVE, sizeof(pidfile));
 
+   /*
+    * If printer sharing is on see if there are any actual shared printers...
+    */
+
+    if (Browsing && BrowseLocalProtocols)
+    {
+      cupsd_printer_t *p = NULL;       /* Current printer */
+
+      for (p = (cupsd_printer_t *)cupsArrayFirst(Printers); p; p = (cupsd_printer_t *)cupsArrayNext(Printers))
+      {
+        if (p->shared)
+          break;
+      }
+
+      shared_printers = (p != NULL);
+    }
+
     if (cupsArrayCount(ActiveJobs) ||  /* Active jobs */
         WebInterface ||                        /* Web interface enabled */
         NeedReload ||                  /* Doing a reload */
-        (Browsing && BrowseLocalProtocols && cupsArrayCount(Printers)))
-                                        /* Printers being shared */
+        shared_printers)                /* Printers being shared */
     {
      /*
       * Create or remove the "keep-alive" file based on whether there are active