From: wessels <> Date: Thu, 24 Sep 1998 02:13:45 +0000 (+0000) Subject: add hash_last() X-Git-Tag: SQUID_3_0_PRE1~2654 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2c4f7ab251a01835052ec9e0e9cfb80fb45dcc1f;p=thirdparty%2Fsquid.git add hash_last() --- diff --git a/include/hash.h b/include/hash.h index 43d668aebe..9044d7382a 100644 --- a/include/hash.h +++ b/include/hash.h @@ -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 *); diff --git a/lib/hash.c b/lib/hash.c index 83bd67956c..c9ed0c67e3 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -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 diff --git a/src/client_db.cc b/src/client_db.cc index 740a74003c..b73040b65c 100644 --- a/src/client_db.cc +++ b/src/client_db.cc @@ -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]); diff --git a/src/forward.cc b/src/forward.cc index 304394f255..cbaef52c3c 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -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) { diff --git a/src/fqdncache.cc b/src/fqdncache.cc index 751abd5cd9..208b54e0ee 100644 --- a/src/fqdncache.cc +++ b/src/fqdncache.cc @@ -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; diff --git a/src/ftp.cc b/src/ftp.cc index 0af18f31d1..2d6daf4b90 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -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 diff --git a/src/gopher.cc b/src/gopher.cc index 47a373913f..4a0016aaa9 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -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 */ diff --git a/src/http.cc b/src/http.cc index 71f6d660db..0792afdc4a 100644 --- a/src/http.cc +++ b/src/http.cc @@ -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; diff --git a/src/net_db.cc b/src/net_db.cc index c844275eda..e385761415 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -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]); diff --git a/src/protos.h b/src/protos.h index eb5996b237..c988b61a0a 100644 --- a/src/protos.h +++ b/src/protos.h @@ -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; diff --git a/src/stat.cc b/src/stat.cc index 446a8e916a..56a06540cf 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -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); } diff --git a/src/structs.h b/src/structs.h index 9502bbba42..85d0399172 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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; }; diff --git a/src/wais.cc b/src/wais.cc index ad61b2e94d..0da9a6adc3 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -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