]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- Changed cachemgr stats/objects listing format.
authorwessels <>
Thu, 17 Oct 1996 17:14:42 +0000 (17:14 +0000)
committerwessels <>
Thu, 17 Oct 1996 17:14:42 +0000 (17:14 +0000)
        - Added some missing "entry->refcount++"
        - Changed StoreEntry->timestamp to be the last verification time.
          (was the stored-on-disk time).
        - Fixed stuck objects from "304 Not Modified" responses without
          final blank line.
        - Added failure detection to icmpRecv().

src/cachemgr.cc
src/client_side.cc
src/http.cc
src/icmp.cc
src/stat.cc
src/store.cc

index 2d8f5b88a44d56c72518c0f83c5e55ecbc91a2ee..8ac2d0119d84d68d0fea6684141d1274875edc5d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: cachemgr.cc,v 1.37 1996/10/15 23:32:51 wessels Exp $
+ * $Id: cachemgr.cc,v 1.38 1996/10/17 11:14:42 wessels Exp $
  *
  * DEBUG: Section 0     CGI Cache Manager
  * AUTHOR: Harvest Derived
@@ -299,7 +299,9 @@ static char *op_cmds_descr[] =
 static int hasTables = FALSE;
 
 static char *script_name = "/cgi-bin/cachemgr.cgi";
-char *progname = NULL;
+static char *w_space = " \t\n";
+static char *progname = NULL;
+static time_t now;
 
 static char x2c _PARAMS((char *));
 static int client_comm_connect _PARAMS((int sock, char *dest_host, u_short dest_port));
@@ -308,11 +310,11 @@ static void noargs_html _PARAMS((char *, int, char *));
 static void unescape_url _PARAMS((char *));
 static void plustospace _PARAMS((char *));
 static void parse_object _PARAMS((char *));
+static char *describeTimeSince _PARAMS((time_t then));
 
 static void
 print_trailer(void)
 {
-    time_t now = time(NULL);
     static char tbuf[128];
     struct tm *gmt;
 
@@ -478,82 +480,122 @@ plustospace(char *str)
            str[x] = ' ';
 }
 
+#define ONE_SECOND (1)
+#define ONE_MINUTE (ONE_SECOND*60)
+#define ONE_HOUR (ONE_MINUTE*60)
+#define ONE_DAY (ONE_HOUR*24)
+#define ONE_WEEK (ONE_DAY*7)
+#define ONE_MONTH (ONE_DAY*30)
+#define ONE_YEAR (ONE_DAY*365)
+
+static char *
+describeTimeSince(time_t then)
+{
+    time_t delta = now - then;
+    static char buf[128];
+    static char buf2[128];
+    char *fmt = "%s ago";
+    buf[0] = '\0';
+    if (delta < 0) {
+       delta = (-delta);
+       fmt = "in %s";
+    }
+    if (delta < ONE_MINUTE)
+       sprintf(buf, "%ds", (int) (delta / ONE_SECOND));
+    else if (delta < ONE_HOUR)
+       sprintf(buf, "%dm", (int) (delta / ONE_MINUTE));
+    else if (delta < ONE_DAY)
+       sprintf(buf, "%dh", (int) (delta / ONE_HOUR));
+    else if (delta < ONE_WEEK)
+       sprintf(buf, "%dD", (int) (delta / ONE_DAY));
+    else if (delta < ONE_MONTH)
+       sprintf(buf, "%dW", (int) (delta / ONE_WEEK));
+    else if (delta < ONE_YEAR)
+       sprintf(buf, "%dM", (int) (delta / ONE_MONTH));
+    else
+       sprintf(buf, "%dY", (int) (delta / ONE_YEAR));
+    sprintf(buf2, fmt, buf);
+    return buf2;
+}
 
 static void
 parse_object(char *string)
 {
-    char *tmp_line = NULL;
+    char *tbuf = NULL;
+    char *store_status = NULL;
+    char *mem_status = NULL;
+    char *swap_status = NULL;
+    char *ping_status = NULL;
+    char *lock_count = NULL;
+    char *flags = NULL;
+    char *last_verified = NULL;
+    char *last_use = NULL;
+    char *last_modified = NULL;
+    char *expires = NULL;
+    char *refcount = NULL;
+    char *clients = NULL;
+    char *size = NULL;
     char *url = NULL;
-    char *token = NULL;
-    char *store_time = NULL;
-    char *last_ref = NULL;
-    char *ttl = NULL;
-    char *sto = NULL;
-    char *status = NULL;
-    char *obj_status = NULL;
-    char *w_space = " \t\n";
-    int obj_size;
-    int ref_cnt;
-
-    /* Use tmp_line as a temporary pointer to the input line */
-    tmp_line = string;
-
-    /* Parse out the url */
-    url = strtok(tmp_line, w_space);
-
-    if (!url)
-       return;
+
+    tbuf = xstrdup(string);
+
+    if ((store_status = strtok(tbuf, w_space)) == NULL)
+       goto parse_obj_done;
+    if ((mem_status = strtok(NULL, w_space)) == NULL)
+       goto parse_obj_done;
+    if ((swap_status = strtok(NULL, w_space)) == NULL)
+       goto parse_obj_done;
+    if ((ping_status = strtok(NULL, w_space)) == NULL)
+       goto parse_obj_done;
+    if ((lock_count = strtok(NULL, w_space)) == NULL)
+       goto parse_obj_done;
+    if ((flags = strtok(NULL, w_space)) == NULL)
+       goto parse_obj_done;
+    if ((last_verified = strtok(NULL, w_space)) == NULL)
+       goto parse_obj_done;
+    if ((last_use = strtok(NULL, w_space)) == NULL)
+       goto parse_obj_done;
+    if ((last_modified = strtok(NULL, w_space)) == NULL)
+       goto parse_obj_done;
+    if ((expires = strtok(NULL, w_space)) == NULL)
+       goto parse_obj_done;
+    if ((refcount = strtok(NULL, w_space)) == NULL)
+       goto parse_obj_done;
+    if ((clients = strtok(NULL, w_space)) == NULL)
+       goto parse_obj_done;
+    if ((size = strtok(NULL, w_space)) == NULL)
+       goto parse_obj_done;
+    if ((url = strtok(NULL, w_space)) == NULL)
+       goto parse_obj_done;
 
 #if !ALL_OBJECTS
     if (!strncmp(url, "cache_object", 12))
-       return;
+       goto parse_obj_done;
     if (!strncmp(url, "POST", 4))
-       return;
+       goto parse_obj_done;
 #endif
 
-    tmp_line = NULL;
-
-    token = strtok(tmp_line, w_space);
-    sscanf(token, "%d", &obj_size);
-
-    token = strtok(tmp_line, w_space);
-    store_time = xstrdup(token);
-
-    token = strtok(tmp_line, w_space);
-    obj_status = xstrdup(token);
-
-    token = strtok(tmp_line, w_space);
-    last_ref = xstrdup(token);
-
-    token = strtok(tmp_line, w_space);
-    ttl = xstrdup(token);
-
-    token = strtok(tmp_line, w_space);
-    /* Active */
-
-    token = strtok(tmp_line, w_space);
-    sscanf(token, "%d", &ref_cnt);
-
-    token = strtok(tmp_line, w_space);
-    sto = xstrdup(token);
-
-    token = strtok(tmp_line, w_space);
-    status = xstrdup(token);
-
-    printf("<LI>Cache: <A HREF=\"%s\">%s</A><BR>",
+    printf("<LI><A HREF=\"%s\">%s</A><BR>",
        url, url);
-    printf("Size: %d bytes, TTL: %s ,<BR>",
-       obj_size, ttl);
-    printf("Stored: %s, %s ago, %s %s,<BR>",
-       sto, store_time, obj_status, status);
-    printf("Refs: %d, Referenced %s hh:mm:ss ago</LI>\n",
-       ref_cnt, last_ref);
-
-    free(ttl);
-    free(store_time);
-    free(last_ref);
-    free(sto);
-    free(status);
+    printf("Verified %s, ", describeTimeSince((time_t) atoi(last_verified + 3)));
+    printf("Used %s, ", describeTimeSince((time_t) atoi(last_use + 3)));
+    printf("Modified %s, ", describeTimeSince((time_t) atoi(last_modified + 3)));
+    printf("Expires %s,<BR>", describeTimeSince((time_t) atoi(expires + 3)));
+    printf("%d bytes, %d accesses, %d active clients,<BR>",
+       atoi(size),
+       atoi(refcount),
+       atoi(clients));
+    printf("%s, %s, %s, %s,<BR>",
+       store_status,
+       mem_status,
+       swap_status,
+       ping_status);
+    printf("%d Locks, Flags: %s\n",
+       atoi(lock_count),
+       flags);
+
+  parse_obj_done:
+    xfree(tbuf);
 }
 
 int
@@ -586,8 +628,8 @@ main(int argc, char *argv[])
     int d1, d2, d3, d4, d5, d6, d7;
     int single = TRUE;
     float f1;
-    time_t time_val;
 
+    now = time(NULL);
     if ((s = strrchr(argv[0], '/')))
        progname = xstrdup(s + 1);
     else
@@ -725,8 +767,7 @@ main(int argc, char *argv[])
        /* NOTREACHED */
     }
 
-    time_val = time(NULL);
-    time_string = ctime(&time_val);
+    time_string = ctime(&now);
 
     printf("<HTML><HEAD><TITLE>Cache Manager: %s:%s:%d</TITLE></HEAD>\n",
        operation, hostname, portnum);
index c3a2672913db29fbcd7042b9c80ac2ea7c4b7721..0e99e6d5da59ee49b1717798d9c82ebd10744dad 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_side.cc,v 1.45 1996/10/15 05:35:53 wessels Exp $
+ * $Id: client_side.cc,v 1.46 1996/10/17 11:14:44 wessels Exp $
  *
  * DEBUG: section 33    Client-side Routines
  * AUTHOR: Duane Wessels
@@ -386,7 +386,7 @@ icpProcessExpired(int fd, icpStateData * icpState)
     debug(33, 5, "icpProcessExpired: setting lmt = %d\n",
        entry->lastmod);
 
-    entry->refcount++;         /* MISS CASE */
+    entry->refcount++;         /* EXPIRED CASE */
     entry->mem_obj->fd_of_first_client = fd;
     icpState->entry = entry;
     icpState->offset = 0;
@@ -409,7 +409,7 @@ icpHandleIMSReply(int fd, StoreEntry * entry, void *data)
     /* unregister this handler */
     storeUnregister(entry, fd);
     if (entry->store_status == STORE_ABORTED) {
-       debug(33, 3, "icpHandleIMSReply: ABORTED/%s '%s'\n",
+       debug(33, 1, "icpHandleIMSReply: ABORTED/%s '%s'\n",
            log_tags[entry->mem_obj->abort_code], entry->url);
        /* We have an existing entry, but failed to validate it,
         * so send the old one anyway */
@@ -417,7 +417,7 @@ icpHandleIMSReply(int fd, StoreEntry * entry, void *data)
        storeUnlockObject(entry);
        icpState->entry = icpState->old_entry;
     } else if (mem->reply->code == 0) {
-       debug(33, 3, "icpHandleIMSReply: Incomplete headers for '%s'\n",
+       debug(33, 1, "icpHandleIMSReply: Incomplete headers for '%s'\n",
            entry->url);
        storeRegister(entry,
            fd,
@@ -425,7 +425,6 @@ icpHandleIMSReply(int fd, StoreEntry * entry, void *data)
            (void *) icpState);
        return 0;
     } else if (mem->reply->code == 304 && !BIT_TEST(icpState->request->flags, REQ_IMS)) {
-
        /* We initiated the IMS request, the client is not expecting
         * 304, so put the good one back.  First, make sure the old entry
         * headers have been loaded from disk. */
@@ -446,6 +445,7 @@ icpHandleIMSReply(int fd, StoreEntry * entry, void *data)
        }
        storeUnlockObject(entry);
        entry = icpState->entry = oldentry;
+       entry->timestamp = squid_curtime;
        if (mime_headers_end(hbuf)) {
            httpParseHeaders(hbuf, entry->mem_obj->reply);
            ttlSet(entry);
@@ -460,6 +460,10 @@ icpHandleIMSReply(int fd, StoreEntry * entry, void *data)
        }
     } else {
        /* the client can handle this reply, whatever it is */
+       if (mem->reply->code == 304) {
+           icpState->old_entry->timestamp = squid_curtime;
+           icpState->old_entry->refcount++;
+       }
        icpState->log_type = LOG_TCP_EXPIRED_MISS;
        storeUnlockObject(icpState->old_entry);
     }
index 4e85e3628ad568885ea60164222dfeaa321216b5..1b22da6c43d7ce4c11224e1b79d8e5ca99d92022 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: http.cc,v 1.84 1996/10/15 05:45:36 wessels Exp $
+ * $Id: http.cc,v 1.85 1996/10/17 11:14:45 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -311,8 +311,11 @@ httpProcessReplyHeader(HttpStateData * httpState, char *buf, int size)
            entry->mem_obj->reply->code = 555;
            return;
        }
-       if ((t = mime_headers_end(httpState->reply_hdr)) == NULL)
-           return;             /* headers not complete */
+       t = httpState->reply_hdr + hdr_len;
+       /* headers can be incomplete only if object still arriving */
+       if (entry->store_status == STORE_PENDING)
+           if ((t = mime_headers_end(httpState->reply_hdr)) == NULL)
+               return;         /* headers not complete */
        *t = '\0';
        reply = entry->mem_obj->reply;
        reply->hdr_sz = t - httpState->reply_hdr;
@@ -484,7 +487,10 @@ httpReadReply(int fd, void *data)
        comm_close(fd);
     } else if (len == 0) {
        /* Connection closed; retrieval done. */
-       storeComplete(entry);
+       if (httpState->reply_hdr_state < 2)
+           httpProcessReplyHeader(httpState, buf, len);
+       storeAppend(entry, buf, len);   /* invoke handlers! */
+       storeComplete(entry);   /* deallocates mem_obj->request */
        comm_close(fd);
     } else if ((entry->mem_obj->e_current_len + len) > Config.Http.maxObjSize &&
        !(entry->flag & DELETE_BEHIND)) {
@@ -505,7 +511,7 @@ httpReadReply(int fd, void *data)
        squid_error_entry(entry, ERR_CLIENT_ABORT, NULL);
        comm_close(fd);
     } else {
-       if (httpState->reply_hdr_state < 2 && len > 0)
+       if (httpState->reply_hdr_state < 2)
            httpProcessReplyHeader(httpState, buf, len);
        storeAppend(entry, buf, len);
        commSetSelect(fd,
index 0d7697d6f86441fdcba369d0a0ac1c9dc919e39c..d682ac5dbaedddac46de2987c0f36f7543cfdb6b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: icmp.cc,v 1.22 1996/10/15 23:32:51 wessels Exp $
+ * $Id: icmp.cc,v 1.23 1996/10/17 11:14:46 wessels Exp $
  *
  * DEBUG: section 37    ICMP Routines
  * AUTHOR: Duane Wessels
@@ -74,6 +74,7 @@ static void
 icmpRecv(int unused1, void *unused2)
 {
     int n;
+    int fail_count = 0;
     pingerReplyData preply;
     static struct sockaddr_in F;
     commSetSelect(icmp_sock,
@@ -87,8 +88,13 @@ icmpRecv(int unused1, void *unused2)
        0);
     if (n < 0) {
        debug(37, 0, "icmpRecv: recv: %s\n", xstrerror());
+       if (++fail_count == 10) {
+           comm_close(icmp_sock);
+           icmp_sock = -1;
+       }
        return;
     }
+    fail_count = 0;
     if (n == 0)                        /* test probe from pinger */
        return;
     F.sin_family = AF_INET;
index 4dec73d68e6c663eb03482030685416d87af1dc1..598b40cf1106b6fffb24f344906535920ac102ea 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.88 1996/10/15 18:06:25 wessels Exp $
+ * $Id: stat.cc,v 1.89 1996/10/17 11:14:48 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -130,11 +130,9 @@ char *close_bracket = "}\n";
 extern char *diskFileName _PARAMS((int));
 
 /* LOCALS */
-static char *stat_describe _PARAMS((StoreEntry * entry));
-static char *mem_describe _PARAMS((StoreEntry * entry));
-static char *ttl_describe _PARAMS((StoreEntry * entry));
-static char *flags_describe _PARAMS((StoreEntry * entry));
-static char *elapsed_time _PARAMS((StoreEntry * entry, int since, char *TTL));
+static char *describeStatuses _PARAMS((StoreEntry *));
+static char *describeFlags _PARAMS((StoreEntry *));
+static char *describeTimestamps _PARAMS((StoreEntry *));
 static void dummyhandler _PARAMS((cacheinfo *, StoreEntry *));
 static void info_get _PARAMS((cacheinfo *, StoreEntry *));
 static void logReadEndHandler _PARAMS((int, int, log_read_data_t *));
@@ -309,44 +307,101 @@ cache_size_get(cacheinfo * obj)
     return size;
 }
 
+static char *
+describeStatuses(StoreEntry * entry)
+{
+    LOCAL_ARRAY(char, buf, 256);
+    sprintf(buf, "%-13s %-13s %-12s %-12s",
+       storeStatusStr[entry->store_status],
+       memStatusStr[entry->mem_status],
+       swapStatusStr[entry->swap_status],
+       pingStatusStr[entry->ping_status]);
+    return buf;
+}
+
+static char *
+describeFlags(StoreEntry * entry)
+{
+    LOCAL_ARRAY(char, buf, 256);
+    int flags = (int) entry->flag;
+    char *t;
+    buf[0] = '\0';
+    if (BIT_TEST(flags, IP_LOOKUP_PENDING))
+       strcat(buf, "IP,");
+    if (BIT_TEST(flags, DELETE_BEHIND))
+       strcat(buf, "DB,");
+    if (BIT_TEST(flags, CLIENT_ABORT_REQUEST))
+       strcat(buf, "CA,");
+    if (BIT_TEST(flags, DELAY_SENDING))
+       strcat(buf, "DS,");
+    if (BIT_TEST(flags, ABORT_MSG_PENDING))
+       strcat(buf, "AP,");
+    if (BIT_TEST(flags, RELEASE_REQUEST))
+       strcat(buf, "RL,");
+    if (BIT_TEST(flags, REFRESH_REQUEST))
+       strcat(buf, "RF,");
+    if (BIT_TEST(flags, ENTRY_CACHABLE))
+       strcat(buf, "EC,");
+    if (BIT_TEST(flags, KEY_CHANGE))
+       strcat(buf, "KC,");
+    if (BIT_TEST(flags, KEY_URL))
+       strcat(buf, "KU,");
+    if (BIT_TEST(flags, ENTRY_HTML))
+       strcat(buf, "HT,");
+    if (BIT_TEST(flags, ENTRY_DISPATCHED))
+       strcat(buf, "ED,");
+    if (BIT_TEST(flags, KEY_PRIVATE))
+       strcat(buf, "KP,");
+    if (BIT_TEST(flags, HIERARCHICAL))
+       strcat(buf, "HI,");
+    if (BIT_TEST(flags, ENTRY_NEGCACHED))
+       strcat(buf, "NG,");
+    if (BIT_TEST(flags, READ_DEFERRED))
+       strcat(buf, "RD,");
+    if ((t = strrchr(buf, ',')))
+       *t = '\0';
+    return buf;
+}
+
+static char *
+describeTimestamps(StoreEntry * entry)
+{
+    LOCAL_ARRAY(char, buf, 256);
+    sprintf(buf, "LV:%-9d LU:%-9d LM:%-9d EX:%-9d",
+       (int) entry->timestamp,
+       (int) entry->lastref,
+       (int) entry->lastmod,
+       (int) entry->expires);
+    return buf;
+}
+
 /* process objects list */
 static void
 stat_objects_get(cacheinfo * obj, StoreEntry * sentry, int vm_or_not)
 {
-    LOCAL_ARRAY(char, space, 40);
-    LOCAL_ARRAY(char, space2, 40);
-    int npend = 0;
     StoreEntry *entry = NULL;
+    MemObject *mem;
     int N = 0;
-    int obj_size;
 
     storeAppendPrintf(sentry, open_bracket);
 
-    for (entry = storeGetFirst();
-       entry != NULL;
-       entry = storeGetNext()) {
-       if (vm_or_not && (entry->mem_status == NOT_IN_MEMORY) &&
-           (entry->swap_status == SWAP_OK))
+    for (entry = storeGetFirst(); entry != NULL; entry = storeGetNext()) {
+       mem = entry->mem_obj;
+       if (vm_or_not && mem == NULL)
            continue;
        if ((++N & 0xFF) == 0) {
            getCurrentTime();
            debug(18, 3, "stat_objects_get:  Processed %d objects...\n", N);
        }
-       obj_size = entry->object_len;
-       npend = storePendingNClients(entry);
-       if (entry->mem_obj)
-           obj_size = entry->mem_obj->e_current_len;
-       storeAppendPrintf(sentry, "{ %s %d %s %s %s %s %d %d %s %s }\n",
-           entry->url,
-           obj_size,
-           elapsed_time(entry, (int) entry->timestamp, space),
-           flags_describe(entry),
-           elapsed_time(entry, (int) entry->lastref, space2),
-           ttl_describe(entry),
-           npend,
+       storeAppendPrintf(sentry, "{%s %dL %-25s %s %3d %2d %8d %s}\n",
+           describeStatuses(entry),
+           (int) entry->lock_count,
+           describeFlags(entry),
+           describeTimestamps(entry),
            (int) entry->refcount,
-           mem_describe(entry),
-           stat_describe(entry));
+           storePendingNClients(entry),
+           mem ? mem->e_current_len : entry->object_len,
+           entry->url);
     }
     storeAppendPrintf(sentry, close_bracket);
 }
@@ -1288,111 +1343,6 @@ stat_init(cacheinfo ** object, char *logfilename)
     *object = obj;
 }
 
-static char *
-stat_describe(StoreEntry * entry)
-{
-    LOCAL_ARRAY(char, state, 256);
-
-    state[0] = '\0';
-    sprintf(state, "%s/%s",
-       storeStatusStr[entry->store_status],
-       pingStatusStr[entry->ping_status]);
-    return (state);
-}
-
-static char *
-mem_describe(StoreEntry * entry)
-{
-    LOCAL_ARRAY(char, where, 100);
-
-    where[0] = '\0';
-    sprintf(where, "D%d/%s/%s",
-       entry->swap_file_number,
-       swapStatusStr[entry->swap_status],
-       memStatusStr[entry->mem_status]);
-    return (where);
-}
-
-
-static char *
-ttl_describe(StoreEntry * entry)
-{
-    int hh, mm, ss;
-    LOCAL_ARRAY(char, TTL, 60);
-    int ttl;
-
-    TTL[0] = '\0';
-    strcpy(TTL, "UNKNOWN");    /* sometimes the TTL isn't set below */
-    ttl = entry->expires - squid_curtime;
-    if (ttl < 0)
-       strcpy(TTL, "EXPIRED");
-    else {
-
-       hh = ttl / 3600;
-       ttl -= hh * 3600;
-       mm = ttl / 60;
-       ttl -= mm * 60;
-       ss = ttl;
-
-       sprintf(TTL, "% 6d:%02d:%02d", hh, mm, ss);
-    }
-    return (TTL);
-}
-
-static char *
-elapsed_time(StoreEntry * entry, int since, char *TTL)
-{
-    int hh, mm, ss, ttl;
-
-    TTL[0] = '\0';
-    strcpy(TTL, "UNKNOWN");    /* sometimes TTL doesn't get set */
-    ttl = squid_curtime - since;
-    if (since == 0) {
-       strcpy(TTL, "NEVER");
-    } else if (ttl < 0) {
-       strcpy(TTL, "EXPIRED");
-    } else {
-       hh = ttl / 3600;
-       ttl -= hh * 3600;
-       mm = ttl / 60;
-       ttl -= mm * 60;
-       ss = ttl;
-       sprintf(TTL, "% 6d:%02d:%02d", hh, mm, ss);
-    }
-    return (TTL);
-}
-
-
-static char *
-flags_describe(StoreEntry * entry)
-{
-    LOCAL_ARRAY(char, FLAGS, 32);
-    char LOCK_CNT[32];
-
-    strcpy(FLAGS, "F:");
-    if (BIT_TEST(entry->flag, KEY_CHANGE))
-       strncat(FLAGS, "K", sizeof(FLAGS) - 1);
-    if (BIT_TEST(entry->flag, ENTRY_CACHABLE))
-       strncat(FLAGS, "C", sizeof(FLAGS) - 1);
-    if (BIT_TEST(entry->flag, REFRESH_REQUEST))
-       strncat(FLAGS, "R", sizeof(FLAGS) - 1);
-    if (BIT_TEST(entry->flag, RELEASE_REQUEST))
-       strncat(FLAGS, "Z", sizeof(FLAGS) - 1);
-    if (BIT_TEST(entry->flag, ABORT_MSG_PENDING))
-       strncat(FLAGS, "A", sizeof(FLAGS) - 1);
-    if (BIT_TEST(entry->flag, DELAY_SENDING))
-       strncat(FLAGS, "D", sizeof(FLAGS) - 1);
-    if (BIT_TEST(entry->flag, IP_LOOKUP_PENDING))
-       strncat(FLAGS, "P", sizeof(FLAGS) - 1);
-    if (entry->lock_count)
-       strncat(FLAGS, "L", sizeof(FLAGS) - 1);
-    if (entry->lock_count) {
-       sprintf(LOCK_CNT, "%d", entry->lock_count);
-       strncat(FLAGS, LOCK_CNT, sizeof(FLAGS) - 1);
-    }
-    return (FLAGS);
-}
-
 void
 stat_rotate_log(void)
 {
index 006a46d2756572833c7abcb6ae482b6c896e2fff..4db602f39db4247a220577ee6ea412c27370ebec 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.131 1996/10/15 23:32:55 wessels Exp $
+ * $Id: store.cc,v 1.132 1996/10/17 11:14:50 wessels Exp $
  *
  * DEBUG: section 20    Storeage Manager
  * AUTHOR: Harvest Derived
@@ -788,7 +788,7 @@ storeCreateEntry(char *url,
     mem->data = new_MemObjectData();
     e->refcount = 0;
     e->lastref = squid_curtime;
-    e->timestamp = 0;          /* set in storeSwapOutHandle() */
+    e->timestamp = 0;          /* set in ttlSet() */
     e->ping_status = PING_NONE;
 
     /* allocate pending list */
@@ -1273,7 +1273,6 @@ storeSwapOutHandle(int fd, int flag, StoreEntry * e)
        debug_trap("Someone is swapping out a bad entry");
        return;
     }
-    e->timestamp = squid_curtime;
     storeSwapFullPath(e->swap_file_number, filename);
 
     if (flag < 0) {
@@ -1416,7 +1415,6 @@ storeDoRebuildFromDisk(struct storeRebuild_data *data)
     int scan4;
     struct stat sb;
     off_t size;
-    int delta;
     int sfileno = 0;
     int count;
     int x;
@@ -1480,6 +1478,7 @@ storeDoRebuildFromDisk(struct storeRebuild_data *data)
                    safeunlink(swapfile, 1);
                continue;
            }
+#ifdef DONT_DO_THIS
            /* timestamp might be a little bigger than sb.st_mtime */
            delta = (int) (timestamp - sb.st_mtime);
            if (delta > REBUILD_TIMESTAMP_DELTA_MAX || delta < 0) {
@@ -1487,13 +1486,16 @@ storeDoRebuildFromDisk(struct storeRebuild_data *data)
                data->clashcount++;
                continue;
            }
+#endif
            /* Wrong size? */
            if (sb.st_size != size) {
                /* this log entry doesn't correspond to this file */
                data->clashcount++;
                continue;
            }
+#ifdef DONT_DO_THIS
            timestamp = sb.st_mtime;
+#endif
            debug(20, 9, "storeRebuildFromDisk: swap file exists: <URL:%s>: %s\n",
                url, swapfile);
        }