From: wessels <> Date: Mon, 19 Oct 1998 23:48:26 +0000 (+0000) Subject: changed helper usage so that during a reconfigure we keep the helper* X-Git-Tag: SQUID_3_0_PRE1~2541 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=838b993cdbfbce97b918f29c32d0a132bb891efa;p=thirdparty%2Fsquid.git changed helper usage so that during a reconfigure we keep the helper* structures around. This keeps pending requests queued and we can submit them soon as the new helper processes are started. --- diff --git a/src/authenticate.cc b/src/authenticate.cc index a45fe03444..89b7073103 100644 --- a/src/authenticate.cc +++ b/src/authenticate.cc @@ -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; } diff --git a/src/dns.cc b/src/dns.cc index 9c9b380fd1..48766929b4 100644 --- a/src/dns.cc +++ b/src/dns.cc @@ -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; } diff --git a/src/helper.cc b/src/helper.cc index c0ed0b75f5..41fe0a5080 100644 --- a/src/helper.cc +++ b/src/helper.cc @@ -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 diff --git a/src/redirect.cc b/src/redirect.cc index b9dc922bb5..c76c29c068 100644 --- a/src/redirect.cc +++ b/src/redirect.cc @@ -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; } diff --git a/src/structs.h b/src/structs.h index 068e74e244..9684c0b162 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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;