]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
make SIGHUP reconfigure the cache; SIGUSR1 rotates logs
authorwessels <>
Thu, 11 Apr 1996 02:45:24 +0000 (02:45 +0000)
committerwessels <>
Thu, 11 Apr 1996 02:45:24 +0000 (02:45 +0000)
src/cache_cf.cc
src/comm.cc
src/ftp.cc
src/gopher.cc
src/http.cc
src/ipcache.cc
src/main.cc
src/neighbors.cc
src/stat.cc
src/store.cc
src/tools.cc

index 35655e5db4185916bf1e16019d00fa7d4c74b401..b564a8397dcd4581e21e375a2ed0a8067b735944 100644 (file)
@@ -1,10 +1,9 @@
-/* $Id: cache_cf.cc,v 1.29 1996/04/10 03:54:42 wessels Exp $ */
+/* $Id: cache_cf.cc,v 1.30 1996/04/10 20:45:24 wessels Exp $ */
 
 /* DEBUG: Section 3             cache_cf: Configuration file parsing */
 
 #include "squid.h"
 
-
 static struct {
     struct {
        int maxSize;
@@ -72,6 +71,13 @@ static struct {
        char *file;
        int rate;
     } Announce;
+    wordlist *cache_dirs;
+    wordlist *http_stoplist;
+    wordlist *gopher_stoplist;
+    wordlist *ftp_stoplist;
+    wordlist *bind_addr_list;
+    wordlist *local_domain_list;
+    wordlist *inside_firewall_list;
 } Config;
 
 #define DefaultMemMaxSize      (16 << 20)      /* 16 MB */
@@ -140,13 +146,6 @@ static struct {
 
 extern char *config_file;
 
-stoplist *http_stoplist = NULL;
-stoplist *gopher_stoplist = NULL;
-stoplist *ftp_stoplist = NULL;
-stoplist *bind_addr_list = NULL;
-stoplist *local_domain_list = NULL;
-stoplist *inside_firewall_list = NULL;
-
  /* default CONNECT ports */
 intlist snews =
 {
@@ -176,8 +175,9 @@ int getDnsChildren();
 
 char w_space[] = " \t\n";
 
-static void configSetFactoryDefaults();
-static void configDoConfigure();
+static void configSetFactoryDefaults _PARAMS((void));
+static void configFreeMemory _PARAMS((void));
+static void configDoConfigure _PARAMS((void));
 static char fatal_str[BUFSIZ];
 
 void self_destruct(in_string)
@@ -414,22 +414,37 @@ void addToIPACL(list, ip_str, access)
 
 #endif /* ndef IPACL_INTS */
 
-void addToStopList(list, key)
-     stoplist **list;
+static void wordlistDestroy(list)
+    wordlist **list;
+{
+    wordlist *w = NULL;
+    wordlist *n = NULL;
+
+    for (w = *list; w; w=n) {
+       n = w->next;
+       safe_free(w->key);
+       safe_free(w);
+    }
+    *list = NULL;
+}
+
+void wordlistAdd(list, key)
+     wordlist **list;
      char *key;
 {
-    stoplist *p, *q;
+    wordlist *p = NULL;
+    wordlist *q = NULL;
 
     if (!(*list)) {
        /* empty list */
-       *list = (stoplist *) xcalloc(1, sizeof(stoplist));
+       *list = (wordlist *) xcalloc(1, sizeof(wordlist));
        (*list)->key = xstrdup(key);
        (*list)->next = NULL;
     } else {
        p = *list;
        while (p->next)
            p = p->next;
-       q = (stoplist *) xcalloc(1, sizeof(stoplist));
+       q = (wordlist *) xcalloc(1, sizeof(wordlist));
        q->key = xstrdup(key);
        q->next = NULL;
        p->next = q;
@@ -782,8 +797,7 @@ static void parseDirLine(line_in)
     token = strtok(NULL, w_space);
     if (token == (char *) NULL)
        self_destruct(line_in);
-    storeAddSwapDisk(xstrdup(token));
-
+    wordlistAdd(&Config.cache_dirs, token);
 }
 
 static void parseHttpdAccelLine(line_in)
@@ -1022,7 +1036,7 @@ static void parseHttpStopLine(line_in)
     token = strtok(NULL, w_space);
     if (token == (char *) NULL)
        return;
-    addToStopList(&http_stoplist, token);
+    wordlistAdd(&Config.http_stoplist, token);
 }
 
 static void parseGopherStopLine(line_in)
@@ -1032,7 +1046,7 @@ static void parseGopherStopLine(line_in)
     token = strtok(NULL, w_space);
     if (token == (char *) NULL)
        return;
-    addToStopList(&gopher_stoplist, token);
+    wordlistAdd(&Config.gopher_stoplist, token);
 }
 static void parseFtpStopLine(line_in)
      char *line_in;
@@ -1041,7 +1055,7 @@ static void parseFtpStopLine(line_in)
     token = strtok(NULL, w_space);
     if (token == (char *) NULL)
        return;
-    addToStopList(&ftp_stoplist, token);
+    wordlistAdd(&Config.ftp_stoplist, token);
 }
 
 static void parseAppendDomainLine(line_in)
@@ -1065,7 +1079,7 @@ static void parseBindAddressLine(line_in)
     if (token == (char *) NULL)
        self_destruct(line_in);
     debug(3, 1, "parseBindAddressLine: adding %s\n", token);
-    addToStopList(&bind_addr_list, token);
+    wordlistAdd(&Config.bind_addr_list, token);
 }
 
 static void parseBlockListLine(line_in)
@@ -1083,7 +1097,7 @@ static void parseLocalDomainLine(line_in)
 {
     char *token;
     while ((token = strtok(NULL, w_space))) {
-       addToStopList(&local_domain_list, token);
+       wordlistAdd(&Config.local_domain_list, token);
     }
 }
 
@@ -1092,7 +1106,7 @@ static void parseInsideFirewallLine(line_in)
 {
     char *token;
     while ((token = strtok(NULL, w_space))) {
-       addToStopList(&inside_firewall_list, token);
+       wordlistAdd(&Config.inside_firewall_list, token);
     }
 }
 
@@ -1234,8 +1248,7 @@ int parseConfigFile(file_name)
     static char tmp_line[BUFSIZ];
     static char line_in[BUFSIZ];
 
-    /* Initialize a few global strings, in case they aren't user defined */
-
+    configFreeMemory();
     configSetFactoryDefaults();
 
     if ((fp = fopen(file_name, "r")) == NULL) {
@@ -1511,7 +1524,7 @@ int parseConfigFile(file_name)
     }
 
     /* Add INADDR_ANY to end of bind_addr_list as last chance */
-    addToStopList(&bind_addr_list, "0.0.0.0");
+    wordlistAdd(&Config.bind_addr_list, "0.0.0.0");
 
     /* Sanity checks */
     if (getClientLifetime() < getReadTimeout()) {
@@ -1765,6 +1778,34 @@ int getAnnounceRate()
 {
     return Config.Announce.rate;
 }
+wordlist * getHttpStoplist()
+{
+    return Config.http_stoplist;
+}
+wordlist * getFtpStoplist()
+{
+    return Config.ftp_stoplist;
+}
+wordlist * getGopherStoplist()
+{
+    return Config.gopher_stoplist;
+}
+wordlist * getLocalDomainList()
+{
+    return Config.local_domain_list;
+}
+wordlist * getCacheDirs()
+{
+    return Config.cache_dirs;
+}
+wordlist * getInsideFirewallList()
+{
+    return Config.inside_firewall_list;
+}
+wordlist * getBindAddrList()
+{
+    return Config.bind_addr_list;
+}
 
 int setAsciiPortNum(p)
      int p;
@@ -1790,6 +1831,36 @@ int safe_strlen(p)
     return p ? strlen(p) : -1;
 }
 
+static void configFreeMemory()
+{
+    safe_free(Config.Wais.relayHost);
+    safe_free(Config.Log.log);
+    safe_free(Config.Log.access);
+    safe_free(Config.Log.hierarchy);
+    safe_free(Config.adminEmail);
+    safe_free(Config.effectiveUser);
+    safe_free(Config.effectiveGroup);
+    safe_free(Config.Program.ftpget);
+    safe_free(Config.Program.ftpget_opts);
+    safe_free(Config.Program.dnsserver);
+    safe_free(Config.Accel.host);
+    safe_free(Config.Accel.prefix);
+    safe_free(Config.appendDomain);
+    safe_free(Config.debugOptions);
+    safe_free(Config.pidFilename);
+    safe_free(Config.visibleHostname);
+    safe_free(Config.ftpUser);
+    safe_free(Config.Announce.host);
+    safe_free(Config.Announce.file);
+    wordlistDestroy(&Config.cache_dirs);
+    wordlistDestroy(&Config.http_stoplist);
+    wordlistDestroy(&Config.gopher_stoplist);
+    wordlistDestroy(&Config.ftp_stoplist);
+    wordlistDestroy(&Config.bind_addr_list);
+    wordlistDestroy(&Config.local_domain_list);
+    wordlistDestroy(&Config.inside_firewall_list);
+}
+
 
 static void configSetFactoryDefaults()
 {
index 0291715f9570de881c3bac490be533c7b1281e0d..8289b0006d24ba68bcacfe5598e99b8fa1043027 100644 (file)
@@ -1,5 +1,5 @@
 
-/* $Id: comm.cc,v 1.19 1996/04/09 18:18:48 wessels Exp $ */
+/* $Id: comm.cc,v 1.20 1996/04/10 20:45:26 wessels Exp $ */
 
 /* DEBUG: Section 5             comm: socket level functions */
 
@@ -105,7 +105,7 @@ int comm_open(io_type, port, handler, note)
     int new_socket;
     FD_ENTRY *conn = NULL;
     int sock_type = io_type & COMM_DGRAM ? SOCK_DGRAM : SOCK_STREAM;
-    stoplist *p = NULL;
+    wordlist *p = NULL;
 
     /* Create socket for accepting new connections. */
     if ((new_socket = socket(AF_INET, sock_type, 0)) < 0) {
@@ -145,10 +145,10 @@ int comm_open(io_type, port, handler, note)
        }
     }
     if (port) {
-       for (p = bind_addr_list; p; p = p->next) {
+       for (p = getBindAddrList(); p; p = p->next) {
            if (do_bind(new_socket, p->key, port) == COMM_OK)
                break;
-           if (p->next == (stoplist *) NULL)
+           if (p->next == (wordlist *) NULL)
                return COMM_ERROR;
        }
     }
index d0dd15a5b03f6ddf28094093ec922f9981f89d39..4c5a0acd189ab6a76b95fdfd143664e39481e8dc 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: ftp.cc,v 1.31 1996/04/10 05:06:57 wessels Exp $ */
+/* $Id: ftp.cc,v 1.32 1996/04/10 20:45:26 wessels Exp $ */
 
 /*
  * DEBUG: Section 9           ftp: FTP
@@ -122,14 +122,12 @@ int ftp_url_parser(url, data)
 int ftpCachable(url)
      char *url;
 {
-    stoplist *p = NULL;
+    wordlist *p = NULL;
 
     /* scan stop list */
-    p = ftp_stoplist;
-    while (p) {
+    for (p = getFtpStoplist(); p; p=p->next) {
        if (strstr(url, p->key))
            return 0;
-       p = p->next;
     }
 
     /* else cachable */
index 72f7e05802314b33d3dc7662223a89db6eaf7496..5b7a5a16279c1dcc962e0f1e4395164a18ae6d48 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: gopher.cc,v 1.22 1996/04/10 03:53:59 wessels Exp $ */
+/* $Id: gopher.cc,v 1.23 1996/04/10 20:45:27 wessels Exp $ */
 
 /*
  * DEBUG: Section 10          gopher: GOPHER
@@ -221,12 +221,12 @@ int gopher_url_parser(url, host, port, type_id, request)
 int gopherCachable(url)
      char *url;
 {
-    stoplist *p = NULL;
+    wordlist *p = NULL;
     GopherData *data = NULL;
     int cachable = 1;
 
     /* scan stop list */
-    for (p = gopher_stoplist; p; p = p->next)
+    for (p = getGopherStoplist(); p; p = p->next)
        if (strstr(url, p->key))
            return 0;
 
index 21df2a5a9263f42f3e0181565ab3cc8dcaa8344b..8e9835b2114060013082803bd3b530f747115f19 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: http.cc,v 1.35 1996/04/10 00:18:49 wessels Exp $ */
+/* $Id: http.cc,v 1.36 1996/04/10 20:45:27 wessels Exp $ */
 
 /*
  * DEBUG: Section 11          http: HTTP
@@ -86,14 +86,14 @@ int httpCachable(url, method, req_hdr)
      int method;
      char *req_hdr;
 {
-    stoplist *p = NULL;
+    wordlist *p = NULL;
 
     /* GET and HEAD are cachable. Others are not. */
     if (method != METHOD_GET && method != METHOD_HEAD)
        return 0;
 
     /* scan stop list */
-    for (p = http_stoplist; p; p = p->next) {
+    for (p = getHttpStoplist(); p; p = p->next) {
        if (strstr(url, p->key))
            return 0;
     }
index cf585deba59914eb1f4777cfe6fb95526f23a504..eedf3323bf63a95fc069202ca27bbfcff0926dda 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: ipcache.cc,v 1.18 1996/04/10 17:58:05 wessels Exp $ */
+/* $Id: ipcache.cc,v 1.19 1996/04/10 20:45:28 wessels Exp $ */
 
 /*
  * DEBUG: Section 14          ipcache: IP Cache
@@ -84,9 +84,10 @@ extern int file_update_open _PARAMS((int, char *));
 void update_dns_child_alive()
 {
     int i;
+    int N = getDnsChildren();
 
     dns_child_alive = 0;
-    for (i = 0; i < getDnsChildren(); ++i) {
+    for (i = 0; i < N; ++i) {
        if (dns_child_table[i]->alive) {
            dns_child_alive = 1;
            break;
@@ -1060,48 +1061,25 @@ int ipcache_nbgethostbyname(name, fd, handler, data)
 }
 
 
-/* initialize the ipcache */
-void ipcache_init()
+void ipcacheOpenServers()
 {
-    int i, dnssocket;
-    char fd_note_buf[FD_ASCII_NOTE_SZ];
-
-    debug(14, 3, "ipcache_init: Called.  ipcache_initialized=%d  getDnsChildren()=%d\n", ipcache_initialized, getDnsChildren());
-
-    if (ipcache_initialized)
-       return;
+    int N = getDnsChildren();
+    char *prg = getDnsProgram();
+    int i;
+    int dnssocket;
+    static char fd_note_buf[FD_ASCII_NOTE_SZ];
 
-    if (mkdir("dns", 0755) < 0 && errno != EEXIST) {
-       debug(14, 0, "ipcache_init: mkdir %s\n", xstrerror());
-    }
-    last_dns_dispatched = getDnsChildren() - 1;
-    dns_error_message = xcalloc(1, 256);
+    if (mkdir("dns", 0755) < 0 && errno != EEXIST)
+       debug(14, 0, "ipcacheOpenServers: mkdir %s\n", xstrerror());
 
-    /* test naming lookup */
-    if (!do_dns_test) {
-       debug(14, 4, "ipcache_init: Skipping DNS name lookup tests, -D flag given.\n");
-    } else if (ipcache_testname() < 0) {
-       fatal("ipcache_init: DNS name lookup appears to be broken on this machine.");
-    } else {
-       debug(14, 1, "Successful DNS name lookup tests...\n");
-    }
-
-    ip_table = hash_create(urlcmp, 229);       /* small hash table */
-    /* init static area */
-    static_result = (struct hostent *) xcalloc(1, sizeof(struct hostent));
-    static_result->h_length = 4;
-    /* Need a terminating NULL address (h_addr_list[1]) */
-    static_result->h_addr_list = (char **) xcalloc(2, sizeof(char *));
-    static_result->h_addr_list[0] = (char *) xcalloc(1, 4);
-    static_result->h_name = (char *) xcalloc(1, MAX_HOST_NAME + 1);
     /* start up companion process */
-    dns_child_table = (dnsserver_entry **) xcalloc(getDnsChildren(), sizeof(dnsserver_entry));
+    safe_free(dns_child_table);
+    dns_child_table = (dnsserver_entry **) xcalloc(N, sizeof(dnsserver_entry));
     dns_child_alive = 0;
-    debug(14, 1, "ipcache_init: Starting %d 'dns_server' processes\n",
-       getDnsChildren());
-    for (i = 0; i < getDnsChildren(); i++) {
+    debug(14, 1, "ipcache_init: Starting %d 'dns_server' processes\n", N);
+    for (i = 0; i < N; i++) {
        dns_child_table[i] = (dnsserver_entry *) xcalloc(1, sizeof(dnsserver_entry));
-       if ((dnssocket = ipcache_create_dnsserver(getDnsProgram())) < 0) {
+       if ((dnssocket = ipcache_create_dnsserver(prg)) < 0) {
            debug(14, 1, "ipcache_init: WARNING: Cannot run 'dnsserver' process.\n");
            debug(14, 1, "              Fallling back to the blocking version.\n");
            dns_child_table[i]->alive = 0;
@@ -1120,7 +1098,7 @@ void ipcache_init()
            /* update fd_stat */
 
            sprintf(fd_note_buf, "%s #%d",
-               getDnsProgram(),
+               prg,
                dns_child_table[i]->id);
            file_update_open(dns_child_table[i]->inpipe, fd_note_buf);
 
@@ -1148,12 +1126,46 @@ void ipcache_init()
            debug(14, 3, "ipcache_init: 'dns_server' %d started\n", i);
        }
     }
+}
+
+/* initialize the ipcache */
+void ipcache_init()
+{
+
+    debug(14, 3, "ipcache_init: Called.  ipcache_initialized=%d  getDnsChildren()=%d\n", ipcache_initialized, getDnsChildren());
+
+    if (ipcache_initialized)
+       return;
+
+    last_dns_dispatched = getDnsChildren() - 1;
+    if (!dns_error_message)
+        dns_error_message = xcalloc(1, 256);
+
+    /* test naming lookup */
+    if (!do_dns_test) {
+       debug(14, 4, "ipcache_init: Skipping DNS name lookup tests, -D flag given.\n");
+    } else if (ipcache_testname() < 0) {
+       fatal("ipcache_init: DNS name lookup appears to be broken on this machine.");
+    } else {
+       debug(14, 1, "Successful DNS name lookup tests...\n");
+    }
+
+    ip_table = hash_create(urlcmp, 229);       /* small hash table */
+    /* init static area */
+    static_result = (struct hostent *) xcalloc(1, sizeof(struct hostent));
+    static_result->h_length = 4;
+    /* Need a terminating NULL address (h_addr_list[1]) */
+    static_result->h_addr_list = (char **) xcalloc(2, sizeof(char *));
+    static_result->h_addr_list[0] = (char *) xcalloc(1, 4);
+    static_result->h_name = (char *) xcalloc(1, MAX_HOST_NAME + 1);
+
+    ipcacheOpenServers();
+
     ipcache_high = (long) (((float) MAX_IP *
            (float) IP_HIGH_WATER) / (float) 100);
     ipcache_low = (long) (((float) MAX_IP *
            (float) IP_LOW_WATER) / (float) 100);
 
-
     ipcache_initialized = 1;
 }
 
@@ -1354,8 +1366,8 @@ void ipcacheShutdownServers()
 
     for (i = 0; i < getDnsChildren(); i++) {
        dns = *(dns_child_table + i);
-       debug(14, 1, "ipcacheShutdownServers: sending '$shutdown' to dnsserver #%d\n", i);
-       debug(14, 1, "ipcacheShutdownServers: --> FD %d\n", dns->outpipe);
+       debug(14, 3, "ipcacheShutdownServers: sending '$shutdown' to dnsserver #%d\n", i);
+       debug(14, 3, "ipcacheShutdownServers: --> FD %d\n", dns->outpipe);
        file_write(dns->outpipe,
            xstrdup(shutdown),
            strlen(shutdown),
index 2ee70a05a9c2652fb584689d7cb9e0a80357c092..60554e8c0e1ad6d56c21527680d4b1efbefd1f1a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: main.cc,v 1.28 1996/04/10 17:58:26 wessels Exp $ */
+/* $Id: main.cc,v 1.29 1996/04/10 20:45:30 wessels Exp $ */
 
 /* DEBUG: Section 1             main: startup and main loop */
 
@@ -160,12 +160,19 @@ void serverConnectionsClose()
     }
 }
 
-static void mainUninitialize()
+static void mainReinitialize()
 {
+    debug(1, 0, "Retarting Harvest Cache (version %s)...\n", SQUID_VERSION);
+    /* Already called serverConnectionsClose and ipcacheShutdownServers() */
     neighborsDestroy();
-    serverConnectionsClose();
-    /* ipcache_uninit() */
-    /* neighbors_uninit(); */
+
+    parseConfigFile(config_file);
+    neighbors_init();
+    ipcacheOpenServers();
+    serverConnectionsOpen();
+    if (theUdpConnection >= 0 && (!httpd_accel_mode || getAccelWithProxy()))
+       neighbors_open(theUdpConnection);
+    debug(1, 0, "Ready to serve requests.\n");
 }
 
 static void mainInitialize()
@@ -274,9 +281,10 @@ int main(argc, argv)
     }
     signal(SIGPIPE, SIG_IGN);
     signal(SIGCHLD, sig_child);
-    signal(SIGHUP, rotate_logs);
+    signal(SIGUSR1, rotate_logs);
     signal(SIGTERM, shut_down);
     signal(SIGINT, shut_down);
+    signal(SIGHUP, reconfigure);
 
     mainInitialize();
 
@@ -321,12 +329,12 @@ int main(argc, argv)
                normal_shutdown();
                exit(0);
            } else if (reread_pending) {
-               mainUninitialize();
-               mainInitialize();
+               mainReinitialize();
                reread_pending = 0;     /* reset */
            } else {
                fatal_dump("MAIN: SHUTDOWN from comm_select, but nothing pending.");
            }
+           break;
        default:
            fatal_dump("MAIN: Internal error -- this should never happen.");
            break;
index 625df96fe499619781f168fe4ae4e2c3224a8708..91912e2cf6001a59226d0fe46b734f4b0a66e734 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: neighbors.cc,v 1.13 1996/04/10 17:57:44 wessels Exp $ */
+/* $Id: neighbors.cc,v 1.14 1996/04/10 20:45:31 wessels Exp $ */
 
 /* TODO:
  * - change 'neighbor' to 'sibling'
@@ -219,14 +219,15 @@ void neighborsDestroy()
     edge *e = NULL;
     edge *next = NULL;
 
-    debug(15, 1, "neighborEdgesFree()\n");
+    debug(15, 3, "neighborsDestroy: called\n");
 
     for (e = friends->edges_head; e; e = next) {
        next = e->next;
        safe_free(e->host);
        safe_free(e);
     }
-    friends->edges_head = NULL;
+    safe_free(friends);
+    friends = NULL;
 }
 
 static void neighborsOpenLog(fname)
@@ -378,8 +379,8 @@ int neighborsUdpPing(proto)
 
        /* e->header.reqnum++; */
        e->header.reqnum = atoi(entry->key);
-       debug(15, 1, "neighborsUdpPing: key = '%s'\n", entry->key);
-       debug(15, 1, "neighborsUdpPing: reqnum = %d\n", e->header.reqnum);
+       debug(15, 3, "neighborsUdpPing: key = '%s'\n", entry->key);
+       debug(15, 3, "neighborsUdpPing: reqnum = %d\n", e->header.reqnum);
 
        if (e->udp_port == echo_port) {
            debug(15, 4, "neighborsUdpPing: Looks like a dumb cache, send DECHO ping\n");
@@ -702,8 +703,9 @@ void neighbors_init()
        friends->edges_tail = e;
        friends->n++;
 
-       xfree(t);
+       safe_free(t);
     }
+    Neighbor_cf = NULL;
 }
 
 void neighbors_rotate_log()
index 59329c5f28ae3b1a9a9fc899f40a4f58e821d6c3..94ecf4c86bbc9f867476a986d1d50a869f1f0543 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: stat.cc,v 1.18 1996/04/10 03:52:56 wessels Exp $ */
+/* $Id: stat.cc,v 1.19 1996/04/10 20:45:32 wessels Exp $ */
 
 /*
  * DEBUG: Section 18          stat
@@ -394,6 +394,7 @@ void info_get(obj, sentry)
 {
     char *tod = NULL;
     static char line[MAX_LINELEN];
+    wordlist *p = NULL;
 
 #if defined(HAVE_GETRUSAGE) && defined(RUSAGE_SELF)
     struct rusage rusage;
@@ -589,9 +590,7 @@ void info_get(obj, sentry)
 
     sprintf(line, "{Stop List:}\n");
     storeAppend(sentry, line, strlen(line));
-    if (http_stoplist) {
-       stoplist *p;
-       p = http_stoplist;
+    if ((p = getHttpStoplist())) {
        sprintf(line, "{\tHTTP:}\n");
        storeAppend(sentry, line, strlen(line));
        while (p) {
@@ -600,9 +599,7 @@ void info_get(obj, sentry)
            p = p->next;
        }
     }
-    if (gopher_stoplist) {
-       stoplist *p;
-       p = gopher_stoplist;
+    if ((p = getGopherStoplist())) {
        sprintf(line, "{\tGOPHER:}\n");
        storeAppend(sentry, line, strlen(line));
        while (p) {
@@ -611,9 +608,7 @@ void info_get(obj, sentry)
            p = p->next;
        }
     }
-    if (ftp_stoplist) {
-       stoplist *p;
-       p = ftp_stoplist;
+    if ((p = getFtpStoplist())) {
        sprintf(line, "{\tFTP:}\n");
        storeAppend(sentry, line, strlen(line));
        while (p) {
index 08d13b346557cd7b1b7301f9aa180e7465fbc6fa..7eb043b1941af42fadf2633cb5df31249e7a7cb1 100644 (file)
@@ -1,6 +1,6 @@
 
-/* $Id: store.cc,v 1.39 1996/04/10 05:07:27 wessels Exp $ */
-#ident "$Id: store.cc,v 1.39 1996/04/10 05:07:27 wessels Exp $"
+/* $Id: store.cc,v 1.40 1996/04/10 20:45:33 wessels Exp $ */
+#ident "$Id: store.cc,v 1.40 1996/04/10 20:45:33 wessels Exp $"
 
 /*
  * DEBUG: Section 20          store
@@ -933,7 +933,9 @@ int storeAddSwapDisk(path)
 {
     if (cache_dirs == NULL)
        cache_dirs = create_dynamic_array(5, 5);
-    insert_dynamic_array(cache_dirs, path);
+    /* XXX note xstrdup here prob means we
+       can't use destroy_dynamic_array() */
+    insert_dynamic_array(cache_dirs, xstrdup(path));
     return ++ncache_dirs;
 }
 
@@ -1048,8 +1050,7 @@ int storeSwapInStart(e)
     e->mem_obj = new_MemObject();
 
     path = storeSwapFullPath(e->swap_file_number, NULL);
-    fd = e->mem_obj->swap_fd = file_open(path, NULL, O_RDONLY);
-    if (fd < 0) {
+    if ((fd = file_open(path, NULL, O_RDONLY)) < 0) {
        debug(20, 0, "storeSwapInStart: Unable to open swapfile: %s\n",
            path);
        debug(20, 0, "storeSwapInStart: --> for <URL:%s>\n",
@@ -1058,6 +1059,7 @@ int storeSwapInStart(e)
        /* Invoke a store abort that should free the memory object */
        return -1;
     }
+    e->mem_obj->swap_fd = (short) fd;
     debug(20, 5, "storeSwapInStart: initialized swap file '%s' for <URL:%s>\n",
        path, e->url);
 
@@ -1183,7 +1185,7 @@ static int storeSwapOutStart(e)
        e->swap_file_number = -1;
        return -1;
     }
-    e->mem_obj->swap_fd = fd;
+    e->mem_obj->swap_fd = (short) fd;
     debug(20, 5, "storeSwapOutStart: Begin SwapOut <URL:%s> to FD %d FILE %s.\n",
        e->url, fd, swapfilename);
 
@@ -2421,9 +2423,12 @@ static void storeCreateSwapSubDirs()
 int storeInit()
 {
     int dir_created;
+    wordlist *w = NULL;
 
     storelog_fd = file_open("store.log", NULL, O_WRONLY | O_APPEND | O_CREAT);
 
+    for (w = getCacheDirs(); w; w=w->next)
+       storeAddSwapDisk(w->key);
     storeSanityCheck();
     file_map_create(MAX_SWAP_FILE);
     dir_created = storeVerifySwapDirs(zap_disk_store);
index ca6e9c2c4987c77208cbbc68b569220070d144ce..66373dedd10df4be81c26a800dd4884e9644d231 100644 (file)
@@ -1,5 +1,5 @@
 
-/* $Id: tools.cc,v 1.27 1996/04/10 05:10:28 wessels Exp $ */
+/* $Id: tools.cc,v 1.28 1996/04/10 20:45:34 wessels Exp $ */
 
 /*
  * DEBUG: Section 21          tools
@@ -139,7 +139,7 @@ void death(sig)
 void rotate_logs(sig)
      int sig;
 {
-    debug(21, 1, "rotate_logs: SIGHUP received.\n");
+    debug(21, 1, "rotate_logs: SIGUSR1 received.\n");
 
     storeWriteCleanLog();
     neighbors_rotate_log();
@@ -398,13 +398,15 @@ time_t getCurrentTime()
 }
 
 
-void usr1_handle(sig)
+void reconfigure(sig)
      int sig;
 {
-    debug(21, 1, "usr1_handle: SIGUSR1 received.\n");
+    debug(21, 1, "reconfigure: SIGHUP received.\n");
 
+    serverConnectionsClose();
+    ipcacheShutdownServers();
     reread_pending = 1;
 #if defined(_SQUID_SYSV_SIGNALS_)
-    signal(sig, rotate_logs);
+    signal(sig, reconfigure);
 #endif
 }