]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Support idle exit, even when printer sharing is enabled but no printers are shared...
authorMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 18 Jun 2018 21:03:23 +0000 (17:03 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Mon, 18 Jun 2018 21:03:23 +0000 (17:03 -0400)
CHANGES.md
scheduler/main.c

index e6a01557fccd2f9da44d9b3d7fb0626d296ad5d0..7538ea683ba1ebc196ad1bbc5c57a98e10f984ea 100644 (file)
@@ -5,6 +5,7 @@ Changes in CUPS v2.3b6
 ----------------------
 
 - Localization update (Issue #5339)
+- The scheduler did not idle-exit on some Linux distributions (Issue #5319)
 - Fixed a regression in the changes to ippValidateAttribute (Issue #5322,
   Issue #5330)
 - Fixed a crash bug in the Epson dot matrix driver (Issue #5323)
index 78bd757e13b6cdf6c933343edbf34259d1ba5eb7..d022aa2040f02d7e92d9ead07d2c6e852e752e5b 100644 (file)
@@ -806,20 +806,31 @@ main(int  argc,                           /* I - Number of command-line args */
 
 #ifdef HAVE_ONDEMAND
    /*
-    * If no other work is scheduled and we're being controlled by
-    * launchd then timeout after 'LaunchdTimeout' seconds of
+    * If no other work is scheduled and we're being controlled by launchd,
+    * systemd, etc. then timeout after 'IdleExitTimeout' seconds of
     * inactivity...
     */
 
     if (timeout == 86400 && OnDemand && IdleExitTimeout &&
-        !cupsArrayCount(ActiveJobs) &&
 #  ifdef HAVE_SYSTEMD
         !WebInterface &&
 #  endif /* HAVE_SYSTEMD */
-       (!Browsing || !BrowseLocalProtocols || !cupsArrayCount(Printers)))
+        !cupsArrayCount(ActiveJobs))
     {
-      timeout          = IdleExitTimeout;
-      service_idle_exit = 1;
+      cupsd_printer_t *p = NULL;       /* Current printer */
+
+      if (Browsing && BrowseLocalProtocols)
+      {
+        for (p = (cupsd_printer_t *)cupsArrayFirst(Printers); p; p = (cupsd_printer_t *)cupsArrayNext(Printers))
+          if (p->shared)
+            break;
+      }
+
+      if (!p)
+      {
+       timeout           = IdleExitTimeout;
+       service_idle_exit = 1;
+      }
     }
     else
       service_idle_exit = 0;