]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
changed helper usage so that during a reconfigure we keep the helper*
authorwessels <>
Mon, 19 Oct 1998 23:48:26 +0000 (23:48 +0000)
committerwessels <>
Mon, 19 Oct 1998 23:48:26 +0000 (23:48 +0000)
structures around.  This keeps pending requests queued and we can
submit them soon as the new helper processes are started.

src/authenticate.cc
src/dns.cc
src/helper.cc
src/redirect.cc
src/structs.h

index a45fe0344472ba894328cb8af1e5267e39de03a0..89b707310347cd5a93023e546e000e33a80b6f2c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: authenticate.cc,v 1.6 1998/10/16 20:02:45 wessels Exp $
+ * $Id: authenticate.cc,v 1.7 1998/10/19 17:48:26 wessels Exp $
  *
  * DEBUG: section 29    Authenticator
  * AUTHOR: Duane Wessels
@@ -105,10 +105,10 @@ void
 authenticateInit(void)
 {
     static int init = 0;
-    assert(authenticators == NULL);
     if (!Config.Program.authenticate)
        return;
-    authenticators = helperCreate("authenticator");
+    if (authenticators == NULL)
+        authenticators = helperCreate("authenticator");
     authenticators->cmdline = Config.Program.authenticate;
     authenticators->n_to_start = Config.authenticateChildren;
     authenticators->ipc_type = IPC_TCP_SOCKET;
@@ -124,9 +124,11 @@ authenticateInit(void)
 void
 authenticateShutdown(void)
 {
-    if (authenticators) {
-       helperShutdown(authenticators);
-       helperFree(authenticators);
-       authenticators = NULL;
-    }
+    if (!authenticators)
+       return;
+    helperShutdown(authenticators);
+    if (!shutting_down)
+       return;
+    helperFree(authenticators);
+    authenticators = NULL;
 }
index 9c9b380fd181d28e1919c38909530c9398924832..48766929b4c9d537cfcf7196fe565580fa30ca83 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: dns.cc,v 1.69 1998/10/16 20:02:45 wessels Exp $
+ * $Id: dns.cc,v 1.70 1998/10/19 17:48:26 wessels Exp $
  *
  * DEBUG: section 34    Dnsserver interface
  * AUTHOR: Harvest Derived
@@ -49,12 +49,13 @@ dnsInit(void)
 {
     static int init = 0;
     wordlist *w;
-    assert(dnsservers == NULL);
     if (!Config.Program.dnsserver)
        return;
-    dnsservers = helperCreate("dnsserver");
+    if (dnsservers == NULL)
+       dnsservers = helperCreate("dnsserver");
     dnsservers->n_to_start = Config.dnsChildren;
     dnsservers->ipc_type = IPC_TCP_SOCKET;
+    assert(dnsservers->cmdline == NULL);
     wordlistAdd(&dnsservers->cmdline, Config.Program.dnsserver);
     if (Config.onoff.res_defnames)
        wordlistAdd(&dnsservers->cmdline, "-D");
@@ -79,6 +80,8 @@ dnsShutdown(void)
        return;
     helperShutdown(dnsservers);
     wordlistDestroy(&dnsservers->cmdline);
+    if (!shutting_down)
+       return;
     helperFree(dnsservers);
     dnsservers = NULL;
 }
index c0ed0b75f5ca39c03b30294250dd3d84ba133f46..41fe0a50805e599c94a8fa8300b84d1156e210fe 100644 (file)
@@ -31,8 +31,6 @@ helperOpenServers(helper * hlp)
     if (hlp->cmdline == NULL)
        return;
     progname = hlp->cmdline->key;
-    assert(hlp->servers.head == NULL);
-    assert(hlp->servers.tail == NULL);
     if ((s = strrchr(progname, '/')))
        shortname = xstrdup(s + 1);
     else
@@ -87,6 +85,7 @@ helperOpenServers(helper * hlp)
     }
     safe_free(shortname);
     safe_free(procname);
+    helperKickQueue(hlp);
 }
 
 void
index b9dc922bb584c3003405a378b33425ab21853efb..c76c29c068edb4448860c841aa40281b70c167e4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: redirect.cc,v 1.73 1998/10/16 20:02:48 wessels Exp $
+ * $Id: redirect.cc,v 1.74 1998/10/19 17:48:28 wessels Exp $
  *
  * DEBUG: section 29    Redirector
  * AUTHOR: Duane Wessels
@@ -126,10 +126,10 @@ void
 redirectInit(void)
 {
     static int init = 0;
-    assert(redirectors == NULL);
     if (!Config.Program.redirect)
        return;
-    redirectors = helperCreate("redirector");
+    if (redirectors == NULL)
+        redirectors = helperCreate("redirector");
     wordlistAdd(&redirectors->cmdline, Config.Program.redirect);
     redirectors->n_to_start = Config.redirectChildren;
     redirectors->ipc_type = IPC_TCP_SOCKET;
@@ -149,6 +149,8 @@ redirectShutdown(void)
        return;
     helperShutdown(redirectors);
     wordlistDestroy(&redirectors->cmdline);
+    if (!shutting_down)
+       return;
     helperFree(redirectors);
     redirectors = NULL;
 }
index 068e74e244c2f108bb9e01dbace6fff39338bc3d..9684c0b162c01bd51c215b07bff4d2d2c1e1ff72 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.243 1998/10/16 20:02:49 wessels Exp $
+ * $Id: structs.h,v 1.244 1998/10/19 17:48:29 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -464,16 +464,8 @@ struct _dread_ctrl {
     void *client_data;
 };
 
-struct _helper_flags {
-    unsigned int alive:1;
-    unsigned int busy:1;
-    unsigned int closing:1;
-    unsigned int shutdown:1;
-};
-
 struct _dnsserver_t {
     int id;
-    helper_flags flags;
     int inpipe;
     int outpipe;
     time_t answer;
@@ -1647,7 +1639,12 @@ struct _helper_server {
     dlink_node link;
     helper *parent;
     helper_request *request;
-    helper_flags flags;
+    struct _helper_flags {
+       unsigned int alive:1;
+       unsigned int busy:1;
+       unsigned int closing:1;
+       unsigned int shutdown:1;
+    } flags;
     struct {
        int uses;
     } stats;