]> 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:56 +0000 (09:07 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Tue, 16 Jul 2019 13:07:56 +0000 (09:07 -0400)
shared (rdar://52561199)

CHANGES.md
scheduler/main.c

index a61c216fe05500b27c9f32bbf80cc99caa9456a0..a8af8ce38b0d8c5a91171f03c8f3ef2b21d9e148 100644 (file)
@@ -1,4 +1,4 @@
-CHANGES - 2.2.12 - 2019-06-12
+CHANGES - 2.2.12 - 2019-07-16
 =============================
 
 
@@ -22,6 +22,8 @@ Changes in CUPS v2.2.12
 - Fixed some compatibility issues with old releases of CUPS (Issue #5587)
 - Fixed a bug in the scheduler job cleanup code (Issue #5588)
 - "make" failed with GZIP options (Issue #5595)
+- The scheduler would restart continuously when idle and printers were not
+  shared (rdar://52561199)
 - Fixed a command ordering issue in the Zebra ZPL driver.
 
 
index 2b8db00a1192ca77c4afba107aa6535290457e58..de368156696e396f0d967dce2f661b0525d751ab 100644 (file)
@@ -749,7 +749,10 @@ main(int  argc,                            /* I - Number of command-line args */
 
 #ifdef HAVE_ONDEMAND
        if (OnDemand)
+       {
+         stop_scheduler = 1;
          break;
+       }
 #endif /* HAVE_ONDEMAND */
 
         DoingShutdown = 1;
@@ -2033,13 +2036,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