/*
- * $Id: main.cc,v 1.147 1997/05/15 23:33:43 wessels Exp $
+ * $Id: main.cc,v 1.148 1997/05/16 07:42:38 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
int Squid_MaxFD = SQUID_MAXFD;
int Biggest_FD = -1;
int select_loops = 0; /* how many times thru select loop */
+int configured_once = 0;
volatile int unbuffered_logs = 1; /* debug and hierarchy unbuffered by default */
volatile int shutdown_pending = 0; /* set by SIGTERM handler (shut_down()) */
-volatile int reread_pending = 0; /* set by SIGHUP handler */
+volatile int reconfigure_pending = 0; /* set by SIGHUP handler */
const char *const version_string = SQUID_VERSION;
const char *const appname = "squid";
const char *const localhost = "127.0.0.1";
static void rotate_logs _PARAMS((int));
static void reconfigure _PARAMS((int));
static void mainInitialize _PARAMS((void));
-static void mainReinitialize _PARAMS((void));
+static void mainReconfigure _PARAMS((void));
static void usage _PARAMS((void));
static void mainParseOptions _PARAMS((int, char **));
static void sendSignal _PARAMS((void));
static void
reconfigure(int sig)
{
- debug(1, 1, "reconfigure: SIGHUP received\n");
- debug(1, 1, "Waiting %d seconds for active connections to finish\n",
- Config.shutdownLifetime);
- reread_pending = 1;
+ reconfigure_pending = 1;
#if !HAVE_SIGACTION
signal(sig, reconfigure);
#endif
}
static void
-mainReinitialize(void)
+mainReconfigure(void)
{
debug(1, 0, "Restarting Squid Cache (version %s)...\n", version_string);
/* Already called serverConnectionsClose and ipcacheShutdownServers() */
static void
mainInitialize(void)
{
- static int first_time = 1;
if (opt_catch_signals) {
squid_signal(SIGSEGV, death, SA_NODEFER | SA_RESETHAND);
squid_signal(SIGBUS, death, SA_NODEFER | SA_RESETHAND);
CONFIG_HOST_TYPE);
debug(1, 1, "With %d file descriptors available\n", Squid_MaxFD);
- if (first_time) {
+ if (!configured_once) {
stmemInit(); /* stmem must go before at least redirect */
disk_init(); /* disk_init must go before ipcache_init() */
}
malloc_debug(0, malloc_debug_level);
#endif
- if (first_time) {
+ if (!configured_once) {
unlinkdInit();
/* module initialization */
urlInitialize();
if (theOutIcpConnection >= 0 && (!httpd_accel_mode || Config.Accel.withProxy))
neighbors_open(theOutIcpConnection);
- if (first_time)
+ if (!configured_once)
writePidFile(); /* write PID file */
squid_signal(SIGUSR1, rotate_logs, SA_RESTART);
squid_signal(SIGINT, shut_down, SA_NODEFER | SA_RESETHAND | SA_RESTART);
debug(1, 0, "Ready to serve requests.\n");
- if (first_time) {
+ if (!configured_once) {
eventAdd("storePurgeOld", storePurgeOld, NULL, Config.cleanRate);
eventAdd("storeMaintain", storeMaintainSwapSpace, NULL, 1);
eventAdd("storeDirClean", storeDirClean, NULL, 15);
eventAdd("start_announce", start_announce, NULL, 3600);
eventAdd("ipcache_purgelru", ipcache_purgelru, NULL, 10);
}
- first_time = 0;
+ configured_once = 1;
}
int
}
if (shutdown_pending) {
normal_shutdown();
- } else if (reread_pending) {
- mainReinitialize();
- reread_pending = 0; /* reset */
+ } else if (reconfigure_pending) {
+ mainReconfigure();
+ reconfigure_pending = 0; /* reset */
} else {
fatal_dump("MAIN: SHUTDOWN from comm_select, but nothing pending.");
}