From: Michael R Sweet Date: Mon, 18 Jun 2018 21:03:23 +0000 (-0400) Subject: Support idle exit, even when printer sharing is enabled but no printers are shared... X-Git-Tag: v2.3b6~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fc5c8d42ef127c72ecdbed976b514face5e173c;p=thirdparty%2Fcups.git Support idle exit, even when printer sharing is enabled but no printers are shared (Issue #5319) --- diff --git a/CHANGES.md b/CHANGES.md index e6a01557fc..7538ea683b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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) diff --git a/scheduler/main.c b/scheduler/main.c index 78bd757e13..d022aa2040 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -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;