/*
- * $Id: comm.cc,v 1.240 1998/03/31 04:09:49 wessels Exp $
+ * $Id: comm.cc,v 1.241 1998/03/31 05:34:46 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
F->timeout_data = NULL;
return F->timeout = 0;
}
- if (shutdown_pending) {
+ if (shutting_down) {
/* don't increase the timeout if something pending */
if (F->timeout > 0 && (int) (F->timeout - squid_curtime) < timeout)
return F->timeout;
F = &fd_table[fd];
if (EBIT_TEST(F->flags, FD_CLOSING))
return;
- if (shutdown_pending && (!F->open || F->type == FD_FILE))
+ if (shutting_down && (!F->open || F->type == FD_FILE))
return;
assert(F->open);
assert(F->type != FD_FILE);
#if !ALARM_UPDATES_TIME
getCurrentTime();
#endif
- if (shutdown_pending) {
+ if (shutting_down) {
serverConnectionsClose();
dnsShutdownServers();
redirectShutdownServers();
- /* shutdown_pending will be set to
+ /* shutting_down will be set to
* +1 for SIGTERM
* -1 for SIGINT */
- if (shutdown_pending > 0)
+ if (shutting_down > 0)
setSocketShutdownLifetimes(Config.shutdownLifetime);
else
setSocketShutdownLifetimes(1);
nfds++;
}
}
- if (shutdown_pending)
+ if (shutting_down)
debug(5, 2) ("comm_poll: Still waiting on %d FDs\n", nfds);
if (nfds == 0)
return COMM_SHUTDOWN;
FD_ZERO(&readfds);
FD_ZERO(&writefds);
- if (shutdown_pending) {
+ if (shutting_down) {
serverConnectionsClose();
dnsShutdownServers();
redirectShutdownServers();
- /* shutdown_pending will be set to
+ /* shutting_down will be set to
* +1 for SIGTERM
* -1 for SIGINT */
- if (shutdown_pending > 0)
+ if (shutting_down > 0)
setSocketShutdownLifetimes(Config.shutdownLifetime);
else
setSocketShutdownLifetimes(1);
FD_SET(i, &writefds);
}
}
- if (shutdown_pending)
+ if (shutting_down)
debug(5, 2) ("comm_select: Still waiting on %d FDs\n", nfds);
if (nfds == 0)
return COMM_SHUTDOWN;
/*
- * $Id: globals.h,v 1.45 1998/03/31 04:09:50 wessels Exp $
+ * $Id: globals.h,v 1.46 1998/03/31 05:34:47 wessels Exp $
*/
extern FILE *debug_log; /* NULL */
extern struct timeval current_time;
extern struct timeval squid_start;
extern time_t squid_curtime; /* 0 */
-extern volatile int shutdown_pending; /* 0 */
+extern int shutting_down; /* 0 */
extern int reconfiguring; /* 0 */
extern int store_rebuilding; /* 1 */
extern int store_swap_size; /* 0 */
/*
- * $Id: main.cc,v 1.241 1998/03/31 04:45:24 wessels Exp $
+ * $Id: main.cc,v 1.242 1998/03/31 05:34:48 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
#endif
static volatile int do_reconfigure = 0;
static volatile int do_rotate = 0;
+static volatile int do_shutdown = 0;
static void mainRotate(void);
static void mainReconfigure(void);
void
shut_down(int sig)
{
- shutdown_pending = sig == SIGINT ? -1 : 1;
+ do_shutdown = sig == SIGINT ? -1 : 1;
#ifdef KILL_PARENT_OPT
if (getppid() > 1) {
debug(1, 1) ("Killing RunCache, pid %d\n", getppid());
} else if (do_rotate) {
mainRotate();
do_rotate = 0;
- } else if (shutdown_pending) {
+ } else if (do_shutdown) {
debug(1, 1) ("Preparing for shutdown after %d requests\n",
Counter.client_http.requests);
debug(1, 1) ("Waiting %d seconds for active connections to finish\n",
- shutdown_pending > 0 ? (int) Config.shutdownLifetime : 0);
+ do_shutdown > 0 ? (int) Config.shutdownLifetime : 0);
+ do_shutdown = 0;
+ shutting_down = 1;
}
eventRun();
if ((loop_delay = eventNextTime()) < 0)
#ifdef SQUID_SNMP
snmpConnectionClose();
#endif
- if (shutdown_pending) {
+ if (shutting_down) {
normal_shutdown();
} else {
- fatal_dump("MAIN: SHUTDOWN from comm_select, but nothing pending.");
+ fatal_dump("MAIN: Unexpected SHUTDOWN from comm_select.");
}
break;
case COMM_TIMEOUT:
/*
- * $Id: redirect.cc,v 1.58 1998/03/31 04:09:51 wessels Exp $
+ * $Id: redirect.cc,v 1.59 1998/03/31 05:34:48 wessels Exp $
*
* DEBUG: section 29 Redirector
* AUTHOR: Duane Wessels
memFree(MEM_8K_BUF, redirector->inbuf);
redirector->inbuf = NULL;
comm_close(fd);
- if (--NRedirectorsOpen == 0 && !shutdown_pending)
+ if (--NRedirectorsOpen == 0 && !shutting_down)
fatal_dump("All redirectors have exited!");
return;
}