]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/server.c
License change: Apache License, Version 2.0.
[thirdparty/cups.git] / scheduler / server.c
index c913469f07befc44fc88ca49cb0f532218298406..cecbabe67f82bf54f6d4ad7fc843b38010ee0edf 100644 (file)
@@ -1,21 +1,10 @@
 /*
- * "$Id: server.c 7927 2008-09-10 22:05:29Z mike $"
+ * Server start/stop routines for the CUPS scheduler.
  *
- *   Server start/stop routines for the CUPS scheduler.
+ * Copyright 2007-2017 by Apple Inc.
+ * Copyright 1997-2006 by Easy Software Products, all rights reserved.
  *
- *   Copyright 2007-2010 by Apple Inc.
- *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
- *
- *   These coded instructions, statements, and computer programs are the
- *   property of Apple Inc. and are protected by Federal copyright
- *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
- *   which should have been included with this file.  If this file is
- *   file is missing or damaged, see the license at "http://www.cups.org/".
- *
- * Contents:
- *
- *   cupsdStartServer() - Start the server.
- *   cupsdStopServer()  - Stop the server.
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
  */
 
 /*
@@ -34,7 +23,7 @@
  * Local globals...
  */
 
-static int     started = 0;
+static int             started = 0;    /* Did we start the server already? */
 
 
 /*
@@ -44,11 +33,17 @@ static int  started = 0;
 void
 cupsdStartServer(void)
 {
+ /*
+  * Start color management (as needed)...
+  */
+
+  cupsdStartColor();
+
  /*
   * Create the default security profile...
   */
 
-  DefaultProfile = cupsdCreateProfile(0);
+  DefaultProfile = cupsdCreateProfile(0, 1);
 
  /*
   * Startup all the networking stuff...
@@ -56,7 +51,6 @@ cupsdStartServer(void)
 
   cupsdStartListening();
   cupsdStartBrowsing();
-  cupsdStartPolling();
 
  /*
   * Create a pipe for CGI processes...
@@ -80,7 +74,7 @@ cupsdStartServer(void)
               CUPSD_EVENT_SERVER_STARTED;
   started   = 1;
 
-  cupsdSetBusyState();
+  cupsdSetBusyState(0);
 }
 
 
@@ -95,12 +89,17 @@ cupsdStopServer(void)
     return;
 
  /*
-  * Close all network clients and stop all jobs...
+  * Stop color management (as needed)...
+  */
+
+  cupsdStopColor();
+
+ /*
+  * Close all network clients...
   */
 
   cupsdCloseAllClients();
   cupsdStopListening();
-  cupsdStopPolling();
   cupsdStopBrowsing();
   cupsdStopAllNotifiers();
   cupsdDeleteAllCerts();
@@ -126,37 +125,30 @@ cupsdStopServer(void)
     CGIPipes[1] = -1;
   }
 
-#ifdef HAVE_NOTIFY_POST
- /*
-  * Send one last notification as the server shuts down.
-  */
-
-  cupsdLogMessage(CUPSD_LOG_DEBUG2,
-                  "notify_post(\"com.apple.printerListChange\") last");
-  notify_post("com.apple.printerListChange");
-#endif /* HAVE_NOTIFY_POST */
-
  /*
   * Close all log files...
   */
 
   if (AccessFile != NULL)
   {
-    cupsFileClose(AccessFile);
+    if (AccessFile != LogStderr)
+      cupsFileClose(AccessFile);
 
     AccessFile = NULL;
   }
 
   if (ErrorFile != NULL)
   {
-    cupsFileClose(ErrorFile);
+    if (ErrorFile != LogStderr)
+      cupsFileClose(ErrorFile);
 
     ErrorFile = NULL;
   }
 
   if (PageFile != NULL)
   {
-    cupsFileClose(PageFile);
+    if (PageFile != LogStderr)
+      cupsFileClose(PageFile);
 
     PageFile = NULL;
   }
@@ -177,8 +169,3 @@ cupsdStopServer(void)
 
   started = 0;
 }
-
-
-/*
- * End of "$Id: server.c 7927 2008-09-10 22:05:29Z mike $".
- */