diff options
author | Michael R Sweet <michael.r.sweet@gmail.com> | 2019-07-16 09:07:17 -0400 |
---|---|---|
committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2019-07-16 09:07:17 -0400 |
commit | e9a4e9d6ea96a93d0b5df2f43b2de087d55b573f (patch) | |
tree | 210003ce2463c33dad29cf0c5476c2ea4031d96d /scheduler | |
parent | c0a097c92f6bd0dbf33a8aa9b93cfc55aa0bc6bb (diff) | |
download | cups-e9a4e9d6ea96a93d0b5df2f43b2de087d55b573f.tar.gz |
The scheduler would restart continuously when idle and printers were not
shared (rdar://52561199)
Diffstat (limited to 'scheduler')
-rw-r--r-- | scheduler/main.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/scheduler/main.c b/scheduler/main.c index 3a2fe7ec9..842b00a42 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -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 |