]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix timeouts for SLP browsing when CUPS browsing is disabled.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 12 Mar 2003 18:49:04 +0000 (18:49 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 12 Mar 2003 18:49:04 +0000 (18:49 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@3450 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES.txt
scheduler/dirsvc.c

index a605cf01820822c6c7e5732173c43b00d4b6a63d..ca13c7d65ed47b071439703d1324d152383e2862 100644 (file)
@@ -3,6 +3,8 @@ CHANGES.txt - 03/12/2003
 
 CHANGES IN CUPS V1.1.19
 
+       - The scheduler would not timeout printers when only
+         using SLP browsing.
        - If the scheduler was unable to execute a filter, it
          would try to restart the job indefinitely until the
          filter could be executed.
index e5e6647abce2750ac52e9252a58c8bd7ea6c643c..79744bc35979e78319c5bf74eb70aa981e1a0ec3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: dirsvc.c,v 1.108 2003/02/05 21:10:16 mike Exp $"
+ * "$Id: dirsvc.c,v 1.109 2003/03/12 18:49:04 mike Exp $"
  *
  *   Directory services routines for the Common UNIX Printing System (CUPS).
  *
@@ -498,7 +498,7 @@ SendBrowseList(void)
                        to;     /* Timeout time */
 
 
-  if (!Browsing || !(BrowseProtocols & BROWSE_CUPS))
+  if (!Browsing || !BrowseProtocols)
     return;
 
  /*
@@ -702,7 +702,7 @@ StartBrowsing(void)
   struct sockaddr_in   addr;   /* Broadcast address */
 
 
-  if (!Browsing)
+  if (!Browsing || !BrowseProtocols)
     return;
 
   if (BrowseProtocols & BROWSE_CUPS)
@@ -715,7 +715,7 @@ StartBrowsing(void)
     {
       LogMessage(L_ERROR, "StartBrowsing: Unable to create broadcast socket - %s.",
                 strerror(errno));
-      Browsing = 0;
+      BrowseProtocols &= ~BROWSE_CUPS;
       return;
     }
 
@@ -735,8 +735,8 @@ StartBrowsing(void)
       close(BrowseSocket);
 #endif /* WIN32 */
 
-      BrowseSocket = -1;
-      Browsing     = 0;
+      BrowseSocket    = -1;
+      BrowseProtocols &= ~BROWSE_CUPS;
       return;
     }
 
@@ -760,8 +760,8 @@ StartBrowsing(void)
       close(BrowseSocket);
 #endif /* WIN32 */
 
-      BrowseSocket = -1;
-      Browsing     = 0;
+      BrowseSocket    = -1;
+      BrowseProtocols &= ~BROWSE_CUPS;
       return;
     }
 
@@ -809,6 +809,9 @@ StartPolling(void)
   char         interval[10];   /* Poll interval */
   int          statusfds[2];   /* Status pipe */
   int          fd;             /* Current file descriptor */
+#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
+  struct sigaction action;     /* POSIX signal handler */
+#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
 
 
  /*
@@ -855,6 +858,12 @@ StartPolling(void)
   {
     sprintf(sport, "%d", poll->port);
 
+   /*
+    * Block signals before forking...
+    */
+
+    HoldSignals();
+
     if ((pid = fork()) == 0)
     {
      /*
@@ -897,6 +906,28 @@ StartPolling(void)
       for (fd = 3; fd < MaxFDs; fd ++)
        close(fd);
 
+     /*
+      * Unblock signals before doing the exec...
+      */
+
+#ifdef HAVE_SIGSET
+      sigset(SIGTERM, SIG_DFL);
+      sigset(SIGCHLD, SIG_DFL);
+#elif defined(HAVE_SIGACTION)
+      memset(&action, 0, sizeof(action));
+
+      sigemptyset(&action.sa_mask);
+      action.sa_handler = SIG_DFL;
+
+      sigaction(SIGTERM, &action, NULL);
+      sigaction(SIGCHLD, &action, NULL);
+#else
+      signal(SIGTERM, SIG_DFL);
+      signal(SIGCHLD, SIG_DFL);
+#endif /* HAVE_SIGSET */
+
+      ReleaseSignals();
+
      /*
       * Execute the polling daemon...
       */
@@ -918,6 +949,8 @@ StartPolling(void)
       LogMessage(L_DEBUG, "StartPolling: Started polling daemon for %s:%d, pid = %d",
                  poll->hostname, poll->port, pid);
     }
+
+    ReleaseSignals();
   }
 
   close(statusfds[1]);
@@ -940,7 +973,7 @@ StartPolling(void)
 void
 StopBrowsing(void)
 {
-  if (!Browsing)
+  if (!Browsing || !BrowseProtocols)
     return;
 
   if (BrowseProtocols & BROWSE_CUPS)
@@ -1853,5 +1886,5 @@ UpdateSLPBrowse(void)
 
 
 /*
- * End of "$Id: dirsvc.c,v 1.108 2003/02/05 21:10:16 mike Exp $".
+ * End of "$Id: dirsvc.c,v 1.109 2003/03/12 18:49:04 mike Exp $".
  */