]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/listen.c
Merge changes from CUPS 1.3.1.
[thirdparty/cups.git] / scheduler / listen.c
index 258e292f7933a16daa570ec45c2b439f0deadb0c..931bc9de1d566332cdbfe135b0d81798627f9794 100644 (file)
@@ -1,26 +1,17 @@
 /*
- * "$Id: listen.c 6123 2006-11-21 15:36:04Z mike $"
+ * "$Id: listen.c 6788 2007-08-13 17:20:14Z mike $"
  *
  *   Server listening routines for the Common UNIX Printing System (CUPS)
  *   scheduler.
  *
+ *   Copyright 2007 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
- *   property of Easy Software Products 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 missing or damaged please contact Easy Software Products
- *   at:
- *
- *       Attn: CUPS Licensing Information
- *       Easy Software Products
- *       44141 Airport View Drive, Suite 204
- *       Hollywood, Maryland 20636 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
+ *   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:
  *
@@ -84,6 +75,10 @@ cupsdPauseListening(void)
   if (cupsArrayCount(Clients) == MaxClients)
     cupsdLogMessage(CUPSD_LOG_WARN,
                     "Max clients reached, holding new connections...");
+  else if (errno == ENFILE || errno == EMFILE)
+    cupsdLogMessage(CUPSD_LOG_WARN,
+                    "Too many open files, holding new connections for "
+                   "30 seconds...");
 
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdPauseListening: Clearing input bits...");
 
@@ -91,6 +86,8 @@ cupsdPauseListening(void)
        lis;
        lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
     cupsdRemoveSelect(lis->fd);
+
+  ListeningPaused = time(NULL) + 30;
 }
 
 
@@ -107,9 +104,7 @@ cupsdResumeListening(void)
   if (cupsArrayCount(Listeners) < 1)
     return;
 
-  if (cupsArrayCount(Clients) >= (MaxClients - 1))
-    cupsdLogMessage(CUPSD_LOG_WARN, "Resuming new connection processing...");
-
+  cupsdLogMessage(CUPSD_LOG_INFO, "Resuming new connection processing...");
   cupsdLogMessage(CUPSD_LOG_DEBUG2,
                   "cupsdResumeListening: Setting input bits...");
 
@@ -117,6 +112,8 @@ cupsdResumeListening(void)
        lis;
        lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
     cupsdAddSelect(lis->fd, (cupsd_selfunc_t)cupsdAcceptClient, NULL, lis);
+
+  ListeningPaused = 0;
 }
 
 
@@ -431,5 +428,5 @@ cupsdStopListening(void)
 
 
 /*
- * End of "$Id: listen.c 6123 2006-11-21 15:36:04Z mike $".
+ * End of "$Id: listen.c 6788 2007-08-13 17:20:14Z mike $".
  */