]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- memset needs to go LAST in comm_close()
authorwessels <>
Tue, 15 Jul 1997 10:03:09 +0000 (10:03 +0000)
committerwessels <>
Tue, 15 Jul 1997 10:03:09 +0000 (10:03 +0000)
- Count invalid during store rebuild.
- storeWriteCleanLog() was using the old swaplog format.

src/comm.cc
src/store.cc

index 6dd2630a716863190dcaf308f2feb9301a89d02c..b0322ccc30035488b451eb4558dc06d41d0129f1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.177 1997/07/15 02:30:17 wessels Exp $
+ * $Id: comm.cc,v 1.178 1997/07/15 04:03:09 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -580,7 +580,6 @@ comm_close(int fd)
        return;
     }
     assert(F->type != FD_FILE);
-    memset(F, '\0', sizeof(fde));
     CommWriteStateCallbackAndFree(fd, COMM_ERROR);
     commCallCloseHandlers(fd);
     fd_close(fd);              /* update fdstat */
@@ -589,6 +588,7 @@ comm_close(int fd)
 #else
     close(fd);
 #endif
+    memset(F, '\0', sizeof(fde));
 }
 
 
index 135c4c51430cbc652a8a2eeb9dcfbb489b03aa4d..5821235261f6c10786173de8180a172caffadb51 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.270 1997/07/15 03:29:05 wessels Exp $
+ * $Id: store.cc,v 1.271 1997/07/15 04:03:11 wessels Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -196,6 +196,7 @@ struct storeRebuildState {
     int linecount;             /* # lines parsed from cache logfile */
     int clashcount;            /* # swapfile clashes avoided */
     int dupcount;              /* # duplicates purged */
+    int invalid;               /* # bad lines */
     int need_to_validate;
     time_t start;
     time_t stop;
@@ -1329,13 +1330,19 @@ storeDoRebuildFromDisk(void *data)
            &scan5,             /* refcount */
            &scan6,             /* flags */
            url);               /* url */
-       if (x < 1)
+       if (x < 1) {
+           RB->invalid++;
            continue;
+       }
        storeSwapFullPath(sfileno, swapfile);
-       if (x != 8)
+       if (x != 8) {
+           RB->invalid++;
            continue;
-       if (sfileno < 0)
+       }
+       if (sfileno < 0) {
+           RB->invalid++;
            continue;
+       }
        sfileno = storeDirProperFileno(d->dirn, sfileno);
        timestamp = (time_t) scan1;
        expires = (time_t) scan2;
@@ -1543,6 +1550,7 @@ storeRebuiltFromDisk(struct storeRebuildState *data)
     r = stop - data->start;
     debug(20, 1) ("Finished rebuilding storage from disk image.\n");
     debug(20, 1) ("  %7d Lines read from previous logfile.\n", data->linecount);
+    debug(20, 1) ("  %7d Invalid lines.\n", data->invalid);
     debug(20, 1) ("  %7d Objects loaded.\n", data->objcount);
     debug(20, 1) ("  %7d Objects expired.\n", data->expcount);
     debug(20, 1) ("  %7d Duplicate URLs purged.\n", data->dupcount);
@@ -2435,12 +2443,14 @@ storeWriteCleanLogs(void)
        assert(dirn < Config.cacheSwap.n_configured);
        if (fd[dirn] < 0)
            continue;
-       sprintf(line, "%08x %08x %08x %08x %9d %s\n",
+       sprintf(line, "%08x %08x %08x %08x %9d %6d %08x %s\n",
            (int) e->swap_file_number,
            (int) e->timestamp,
            (int) e->expires,
            (int) e->lastmod,
            e->object_len,
+           e->refcount,
+           e->flag,
            e->url);
        if (write(fd[dirn], line, strlen(line)) < 0) {
            debug(50, 0) ("storeWriteCleanLogs: %s: %s\n", new[dirn], xstrerror());