]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
add hash_last()
authorwessels <>
Thu, 24 Sep 1998 02:13:45 +0000 (02:13 +0000)
committerwessels <>
Thu, 24 Sep 1998 02:13:45 +0000 (02:13 +0000)
13 files changed:
include/hash.h
lib/hash.c
src/client_db.cc
src/forward.cc
src/fqdncache.cc
src/ftp.cc
src/gopher.cc
src/http.cc
src/net_db.cc
src/protos.h
src/stat.cc
src/structs.h
src/wais.cc

index 43d668aebebeb0b03c49931a331c304223520f63..9044d7382a385f1f2518ec0ca0a762a1f5c009c6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: hash.h,v 1.2 1998/09/23 17:19:58 wessels Exp $
+ * $Id: hash.h,v 1.3 1998/09/23 20:13:46 wessels Exp $
  */
 
 typedef void HASHFREE(void *);
@@ -30,6 +30,7 @@ extern int hashPrime(int n);
 extern void *hash_lookup(hash_table *, const void *);
 extern void hash_first(hash_table *);
 extern void *hash_next(hash_table *);
+extern void hash_last(hash_table *);
 extern hash_link *hash_get_bucket(hash_table *, unsigned int);
 extern void hashFreeMemory(hash_table *);
 extern void hashFreeItems(hash_table *, HASHFREE *);
index 83bd67956cbf3ec87cbd5c78b0b327ddf5b6f4f5..c9ed0c67e32c301472386f616fcc378bbdfcf1a0 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: hash.c,v 1.3 1998/08/18 03:09:50 wessels Exp $
+ * $Id: hash.c,v 1.4 1998/09/23 20:13:45 wessels Exp $
  *
  * DEBUG: section 0     Hash Tables
  * AUTHOR: Harvest Derived
@@ -232,6 +232,18 @@ hash_next(hash_table * hid)
     return this;
 }
 
+/*
+ *  hash_last - resets hash traversal state to NULL
+ *
+ */
+void
+hash_next(hash_table * hid)
+{
+    assert(hid);
+    hid->next = NULL;
+    hid->current_slot = 0;
+}
+
 /*
  *  hash_remove_link - deletes the given hash_link node from the 
  *  hash table 'hid'.  Does not free the item, only removes it
index 740a74003c678b090b685fa11be14ad5b79b5646..b73040b65c031f550bd84514cad982b4ab0755e3 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: client_db.cc,v 1.38 1998/07/22 20:37:08 wessels Exp $
+ * $Id: client_db.cc,v 1.39 1998/09/23 20:13:47 wessels Exp $
  *
  * DEBUG: section 0     Client Database
  * AUTHOR: Duane Wessels
@@ -209,6 +209,7 @@ meshCtblGetRowFn(oid * New, oid * Oid)
     if (!Oid[0] && !Oid[1] && !Oid[2] && !Oid[3]) {
        hash_first(client_table);
        c = (ClientInfo *) hash_next(client_table);
+       hash_last(client_table);
     } else {
        char key[15];
        snprintf(key, sizeof(key), "%d.%d.%d.%d", Oid[0], Oid[1], Oid[2], Oid[3]);
index 304394f2550ecbc19e902b856fa70b96632b198b..cbaef52c3ca39e64025f1b51ad737e757fff3a3c 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: forward.cc,v 1.29 1998/09/21 20:53:37 wessels Exp $
+ * $Id: forward.cc,v 1.30 1998/09/23 20:13:48 wessels Exp $
  *
  * DEBUG: section 17    Request Forwarding
  * AUTHOR: Duane Wessels
@@ -368,31 +368,6 @@ fwdStart(int fd, StoreEntry * e, request_t * r, struct in_addr peer_addr)
     peerSelect(r, e, fwdStartComplete, fwdStartFail, fwdState);
 }
 
-/* This is called before reading data from the server side to
- * decide if the server side should abort the fetch.
- * XXX This probably breaks quick_abort!
- * When to abort?
- * - NOT if there are clients reading
- * - YES if we don't know the content length
- * - YES if we do know the content length and we don't have the
- * whole object
- */
-int
-fwdAbortFetch(StoreEntry * entry)
-{
-    MemObject *mem;
-    const HttpReply *reply;
-    if (storeClientWaiting(entry))
-       return 0;
-    mem = entry->mem_obj;
-    reply = mem->reply;
-    if (reply->content_length < 0)
-       return 1;
-    if (mem->inmem_hi < reply->content_length + reply->hdr_sz)
-       return 1;
-    return 0;
-}
-
 int
 fwdCheckDeferRead(int fdnotused, void *data)
 {
index 751abd5cd99e0ef11f19850a787992390cf59aca..208b54e0ee8a37817ecc61da0d6ee269eae75c84 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: fqdncache.cc,v 1.117 1998/09/19 17:06:02 wessels Exp $
+ * $Id: fqdncache.cc,v 1.118 1998/09/23 20:13:48 wessels Exp $
  *
  * DEBUG: section 35    FQDN Cache
  * AUTHOR: Harvest Derived
@@ -826,6 +826,7 @@ snmp_fqdncacheFn(variable_list * Var, snint * ErrP)
        if (NULL == fq)
            break;
     }
+    hash_last(fqdn_table);
     if (fq == NULL || cnt != 0) {
        *ErrP = SNMP_ERR_NOSUCHNAME;
        return NULL;
index 0af18f31d121124b3ad67c386b45ff43314d690c..2d6daf4b90466a52fcb5a6e2434c916d9c998643 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ftp.cc,v 1.252 1998/09/19 17:06:03 wessels Exp $
+ * $Id: ftp.cc,v 1.253 1998/09/23 20:13:49 wessels Exp $
  *
  * DEBUG: section 9     File Transfer Protocol (FTP)
  * AUTHOR: Harvest Derived
@@ -798,11 +798,6 @@ ftpDataRead(int fd, void *data)
     delay_id delay_id = delayMostBytesAllowed(mem);
 #endif
     assert(fd == ftpState->data.fd);
-    if (fwdAbortFetch(entry)) {
-       storeAbort(entry, 0);
-       ftpDataTransferDone(ftpState);
-       return;
-    }
     errno = 0;
     read_sz = ftpState->data.size - ftpState->data.offset;
 #if DELAY_POOLS
index 47a373913ff00bf86d7d370ddc25b023d28f71d7..4a0016aaa9d5b6f6dde5e39d91e6fe0002fa3e46 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: gopher.cc,v 1.139 1998/09/19 17:06:04 wessels Exp $
+ * $Id: gopher.cc,v 1.140 1998/09/23 20:13:50 wessels Exp $
  *
  * DEBUG: section 10    Gopher
  * AUTHOR: Harvest Derived
@@ -600,11 +600,6 @@ gopherReadReply(int fd, void *data)
 #if DELAY_POOLS
     delay_id delay_id = delayMostBytesAllowed(entry->mem_obj);
 #endif
-    if (fwdAbortFetch(entry)) {
-       storeAbort(entry, 0);
-       comm_close(fd);
-       return;
-    }
     errno = 0;
     buf = memAllocate(MEM_4K_BUF);
     read_sz = 4096 - 1;                /* leave room for termination */
index 71f6d660dbda92d92944e42352b159b16e984560..0792afdc4a3fbafc0e4099447e2495a828254148 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: http.cc,v 1.323 1998/09/21 06:52:14 wessels Exp $
+ * $Id: http.cc,v 1.324 1998/09/23 20:13:51 wessels Exp $
  *
  * DEBUG: section 11    Hypertext Transfer Protocol (HTTP)
  * AUTHOR: Harvest Derived
@@ -411,11 +411,6 @@ httpReadReply(int fd, void *data)
 #if DELAY_POOLS
     delay_id delay_id = delayMostBytesAllowed(entry->mem_obj);
 #endif
-    if (fwdAbortFetch(entry)) {
-       storeAbort(entry, 0);
-       comm_close(fd);
-       return;
-    }
     /* check if we want to defer reading */
     errno = 0;
     read_sz = SQUID_TCP_SO_RCVBUF;
index c844275edaf04493ffc7039ec880ce40f77fad0f..e385761415862ca6fa0985816b333c7af7d8250a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: net_db.cc,v 1.127 1998/09/15 19:37:54 wessels Exp $
+ * $Id: net_db.cc,v 1.128 1998/09/23 20:13:52 wessels Exp $
  *
  * DEBUG: section 38    Network Measurement Database
  * AUTHOR: Duane Wessels
@@ -883,6 +883,7 @@ netdbGetRowFn(oid * New, oid * Oid)
     if (!Oid[0] && !Oid[1] && !Oid[2] && !Oid[3]) {
        hash_first(addr_table);
        c = (netdbEntry *) hash_next(addr_table);
+       hash_last(addr_table);
     } else {
        static char key[15];
        snprintf(key, sizeof(key), "%d.%d.%d.%d", Oid[0], Oid[1], Oid[2], Oid[3]);
index eb5996b237c7991b279d6d21442d5f2a8dacbca4..c988b61a0ae3e88fdab0b32147494ff85a390c7d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.270 1998/09/21 06:52:19 wessels Exp $
+ * $Id: protos.h,v 1.271 1998/09/23 20:13:53 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -623,7 +623,6 @@ extern EVH peerDigestInit;
 
 /* forward.c */
 extern void fwdStart(int, StoreEntry *, request_t *, struct in_addr);
-extern int fwdAbortFetch(StoreEntry * entry);
 extern DEFER fwdCheckDeferRead;
 extern void fwdFail(FwdState *, int, http_status, int);
 extern STABH fwdAbort;
index 446a8e916a2d666955ea2511f1585e252e0af41f..56a06540cf7f257b093b5a7d5af76ee01c16a3b1 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stat.cc,v 1.293 1998/09/22 23:15:39 wessels Exp $
+ * $Id: stat.cc,v 1.294 1998/09/23 20:13:54 wessels Exp $
  *
  * DEBUG: section 18    Cache Manager Statistics
  * AUTHOR: Harvest Derived
@@ -752,8 +752,8 @@ statAvgDump(StoreEntry * sentry, int minutes, int hours)
        : 0.0);
     x = statHistDeltaMedian(&l->select_fds_hist, &f->select_fds_hist);
     storeAppendPrintf(sentry, "median_select_fds = %f\n", x);
-    storeAppendPrintf(sentry, "store_files_cleaned = %f/sec\n",
-       XAVG(store_files_cleaned));
+    storeAppendPrintf(sentry, "swap_files_cleaned = %f/sec\n",
+       XAVG(swap_files_cleaned));
     storeAppendPrintf(sentry, "aborted_requests = %f/sec\n",
        XAVG(aborted_requests));
 
@@ -1096,8 +1096,8 @@ statCountersDump(StoreEntry * sentry)
        f->cputime);
     storeAppendPrintf(sentry, "wall_time = %f\n",
        tvSubDsec(f->timestamp, current_time));
-    storeAppendPrintf(sentry, "store_files_cleaned = %d\n",
-       f->store_files_cleaned);
+    storeAppendPrintf(sentry, "swap_files_cleaned = %d\n",
+       f->swap_files_cleaned);
     storeAppendPrintf(sentry, "aborted_requests = %d\n",
        f->aborted_requests);
 }
index 9502bbba42275612bd25f1b5abb5b9ed5c253f62..85d0399172197a6355c1b5451eb3bb6866f908f1 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: structs.h,v 1.234 1998/09/23 15:37:44 wessels Exp $
+ * $Id: structs.h,v 1.235 1998/09/23 20:13:56 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -1474,7 +1474,7 @@ struct _StatCounters {
        int selects;
 #endif
     } syscalls;
-    int store_files_cleaned;
+    int swap_files_cleaned;
     int aborted_requests;
 };
 
index ad61b2e94d02ef7a7b30fe0b5263e2d3fee3eef6..0da9a6adc3003967a0b6e4082df41aa21358ebe7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: wais.cc,v 1.120 1998/09/19 17:06:19 wessels Exp $
+ * $Id: wais.cc,v 1.121 1998/09/23 20:13:57 wessels Exp $
  *
  * DEBUG: section 24    WAIS Relay
  * AUTHOR: Harvest Derived
@@ -90,14 +90,6 @@ waisReadReply(int fd, void *data)
 #if DELAY_POOLS
     delay_id delay_id = delayMostBytesAllowed(entry->mem_obj);
 #endif
-    if (fwdAbortFetch(entry)) {
-       ErrorState *err;
-       err = errorCon(ERR_CLIENT_ABORT, HTTP_INTERNAL_SERVER_ERROR);
-       err->request = urlParse(METHOD_CONNECT, waisState->request);
-       errorAppendEntry(entry, err);
-       comm_close(fd);
-       return;
-    }
     errno = 0;
     read_sz = 4096;
 #if DELAY_POOLS