From: wessels <> Date: Mon, 11 Jan 1999 23:50:27 +0000 (+0000) Subject: changed store_status STORE_ABORTED to entry->flags ENTRY_ABORTED X-Git-Tag: SQUID_3_0_PRE1~2443 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b7fe0ab0da55fe5c9a2f9cb01dc45a38b0076abb;p=thirdparty%2Fsquid.git changed store_status STORE_ABORTED to entry->flags ENTRY_ABORTED --- diff --git a/src/asn.cc b/src/asn.cc index ca6ad7d68f..e114c1f349 100644 --- a/src/asn.cc +++ b/src/asn.cc @@ -1,5 +1,5 @@ /* - * $Id: asn.cc,v 1.53 1999/01/07 22:13:35 wessels Exp $ + * $Id: asn.cc,v 1.54 1999/01/11 16:50:27 wessels Exp $ * * DEBUG: section 53 AS Number handling * AUTHOR: Duane Wessels, Kostas Anagnostakis @@ -221,7 +221,7 @@ asHandleReply(void *data, char *buf, ssize_t size) char *s; char *t; debug(53, 3) ("asHandleReply: Called with size=%d\n", size); - if (e->store_status == STORE_ABORTED) { + if (EBIT_TEST(e->flags, ENTRY_ABORTED)) { memFree(buf, MEM_4K_BUF); asStateFree(asState); return; diff --git a/src/client_side.cc b/src/client_side.cc index 783efcf4ff..05287f58a7 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.426 1999/01/08 21:12:06 wessels Exp $ + * $Id: client_side.cc,v 1.427 1999/01/11 16:50:29 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -315,8 +315,8 @@ clientProcessExpired(void *data) fwdStart(http->conn->fd, http->entry, http->request, http->conn->peer.sin_addr); /* Register with storage manager to receive updates when data comes in. */ - if (entry->store_status == STORE_ABORTED) - debug(33, 0) ("clientProcessExpired: entry->swap_status == STORE_ABORTED\n"); + if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) + debug(33, 0) ("clientProcessExpired: found ENTRY_ABORTED object\n"); storeClientCopy(entry, http->out.offset, http->out.offset, @@ -370,9 +370,9 @@ clientHandleIMSReply(void *data, char *buf, ssize_t size) int recopy = 1; const http_status status = mem->reply->sline.status; debug(33, 3) ("clientHandleIMSReply: %s, %d bytes\n", url, (int) size); - if (size < 0 && entry->store_status != STORE_ABORTED) + if (size < 0 && !EBIT_TEST(entry->flags, ENTRY_ABORTED)) return; - if (entry->store_status == STORE_ABORTED) { + if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { debug(33, 3) ("clientHandleIMSReply: ABORTED '%s'\n", url); /* We have an existing entry, but failed to validate it */ /* Its okay to send the old one anyway */ @@ -440,7 +440,7 @@ clientHandleIMSReply(void *data, char *buf, ssize_t size) recopy = 0; } http->old_entry = NULL; /* done with old_entry */ - assert(entry->store_status != STORE_ABORTED); + assert(!EBIT_TEST(entry->flags, ENTRY_ABORTED)); if (recopy) { storeClientCopy(entry, http->out.offset, @@ -1174,7 +1174,7 @@ clientCacheHit(void *data, char *buf, ssize_t size) } assert(size > 0); mem = e->mem_obj; - assert(e->store_status != STORE_ABORTED); + assert(!EBIT_TEST(e->flags, ENTRY_ABORTED)); if (mem->reply->sline.status == 0) { /* * we don't have full reply headers yet; either wait for more or @@ -1444,7 +1444,7 @@ clientSendMoreData(void *data, char *buf, ssize_t size) debug(33, 1) ("clientSendMoreData: Deferring %s\n", storeUrl(entry)); memFree(buf, MEM_CLIENT_SOCK_BUF); return; - } else if (entry && entry->store_status == STORE_ABORTED) { + } else if (entry && EBIT_TEST(entry->flags, ENTRY_ABORTED)) { /* call clientWriteComplete so the client socket gets closed */ clientWriteComplete(fd, NULL, 0, COMM_OK, http); memFree(buf, MEM_CLIENT_SOCK_BUF); @@ -1572,8 +1572,8 @@ clientKeepaliveNextRequest(clientHttpRequest * http) conn->fd); assert(entry); if (0 == storeClientCopyPending(entry, http)) { - if (entry->store_status == STORE_ABORTED) - debug(33, 0) ("clientKeepaliveNextRequest: entry->swap_status == STORE_ABORTED\n"); + if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) + debug(33, 0) ("clientKeepaliveNextRequest: ENTRY_ABORTED\n"); storeClientCopy(entry, http->out.offset, http->out.offset, @@ -1606,7 +1606,7 @@ clientWriteComplete(int fd, char *bufnotused, size_t size, int errflag, void *da comm_close(fd); } else if (NULL == entry) { comm_close(fd); /* yuk */ - } else if (entry->store_status == STORE_ABORTED) { + } else if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { comm_close(fd); } else if ((done = clientCheckTransferDone(http)) != 0 || size == 0) { debug(33, 5) ("clientWriteComplete: FD %d transfer is DONE\n", fd); @@ -1629,8 +1629,8 @@ clientWriteComplete(int fd, char *bufnotused, size_t size, int errflag, void *da } else { /* More data will be coming from primary server; register with * storage manager. */ - if (entry->store_status == STORE_ABORTED) - debug(33, 0) ("clientWriteComplete 2: entry->swap_status == STORE_ABORTED\n"); + if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) + debug(33, 0) ("clientWriteComplete 2: ENTRY_ABORTED\n"); storeClientCopy(entry, http->out.offset, http->out.offset, @@ -2457,10 +2457,10 @@ clientCheckTransferDone(clientHttpRequest * http) if (http->flags.done_copying) return 1; /* - * Handle STORE_OK and STORE_ABORTED objects. + * Handle STORE_OK objects. * objectLen(entry) will be set proprely. */ - if (entry->store_status != STORE_PENDING) { + if (entry->store_status == STORE_OK) { if (http->out.offset >= objectLen(entry)) return 1; else @@ -2490,8 +2490,7 @@ clientCheckTransferDone(clientHttpRequest * http) /* * Figure out how much data we are supposed to send. * If we are sending a body and we don't have a content-length, - * then we must wait for the object to become STORE_OK or - * STORE_ABORTED. + * then we must wait for the object to become STORE_OK. */ if (sending == SENDING_HDRSONLY) sendlen = reply->hdr_sz; diff --git a/src/enums.h b/src/enums.h index 7906dbf952..4aa4ffea20 100644 --- a/src/enums.h +++ b/src/enums.h @@ -1,6 +1,6 @@ /* - * $Id: enums.h,v 1.140 1998/12/05 00:54:22 wessels Exp $ + * $Id: enums.h,v 1.141 1999/01/11 16:50:30 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -339,8 +339,7 @@ enum { enum { STORE_OK, - STORE_PENDING, - STORE_ABORTED + STORE_PENDING }; enum { @@ -447,7 +446,8 @@ enum { ENTRY_FWD_HDR_WAIT, ENTRY_NEGCACHED, ENTRY_VALIDATED, - ENTRY_BAD_LENGTH + ENTRY_BAD_LENGTH, + ENTRY_ABORTED }; typedef enum { diff --git a/src/forward.cc b/src/forward.cc index 800afd7863..eaa28ea858 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -1,6 +1,6 @@ /* - * $Id: forward.cc,v 1.41 1999/01/08 21:12:10 wessels Exp $ + * $Id: forward.cc,v 1.42 1999/01/11 16:50:31 wessels Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -423,7 +423,6 @@ fwdStart(int fd, StoreEntry * e, request_t * r, struct in_addr client_addr) fwdState->request = requestLink(r); fwdState->start = squid_curtime; storeLockObject(e); - storeRegisterAbort(e, fwdAbort, fwdState); peerSelect(r, e, fwdStartComplete, fwdState); } @@ -456,17 +455,6 @@ fwdFail(FwdState * fwdState, int err_code, http_status http_code, int xerrno) fwdState->fail.xerrno = xerrno; } -/* - * Called when someone else calls StoreAbort() on this entry - */ -void -fwdAbort(void *data) -{ - FwdState *fwdState = data; - debug(17, 3) ("fwdAbort: %s\n", storeUrl(fwdState->entry)); - fwdStateFree(fwdState); -} - /* * Frees fwdState without closing FD or generating an abort */ @@ -475,6 +463,7 @@ fwdUnregister(int fd, FwdState * fwdState) { debug(17, 3) ("fwdUnregister: %s\n", storeUrl(fwdState->entry)); assert(fd = fwdState->server_fd); + assert(fd > -1); comm_remove_close_handler(fd, fwdServerClosed, fwdState); fwdState->server_fd = -1; } diff --git a/src/http.cc b/src/http.cc index 2ed19a9366..88c9fee7cb 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.335 1999/01/08 21:12:14 wessels Exp $ + * $Id: http.cc,v 1.336 1999/01/11 16:50:32 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -504,7 +504,7 @@ httpReadReply(int fd, void *data) } storeAppend(entry, buf, len); #ifdef OPTIMISTIC_IO - if (entry->store_status == STORE_ABORTED) { + if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { /* * the above storeAppend() call could ABORT this entry, * in that case, the server FD should already be closed. diff --git a/src/neighbors.cc b/src/neighbors.cc index b26f8b54ad..cd48e048dd 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.266 1998/12/16 00:07:19 wessels Exp $ + * $Id: neighbors.cc,v 1.267 1999/01/11 16:50:33 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -1095,7 +1095,7 @@ peerCountMcastPeersDone(void *data) p->mcast.avg_n_members, p->stats.rtt); p->mcast.n_replies_expected = (int) p->mcast.avg_n_members; - fake->store_status = STORE_ABORTED; + EBIT_SET(fake->flags, ENTRY_ABORTED); requestUnlink(fake->mem_obj->request); fake->mem_obj->request = NULL; storeReleaseRequest(fake); diff --git a/src/net_db.cc b/src/net_db.cc index 89ab8164a9..ee41bd1fd6 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -1,6 +1,6 @@ /* - * $Id: net_db.cc,v 1.134 1998/12/05 00:54:34 wessels Exp $ + * $Id: net_db.cc,v 1.135 1999/01/11 16:50:35 wessels Exp $ * * DEBUG: section 38 Network Measurement Database * AUTHOR: Duane Wessels @@ -587,8 +587,8 @@ netdbExchangeHandleReply(void *data, char *buf, ssize_t size) debug(38, 3) ("netdbExchangeHandleReply: used %d entries, (x %d bytes) == %d bytes total\n", nused, rec_sz, nused * rec_sz); debug(38, 3) ("netdbExchangeHandleReply: seen %d, used %d\n", ex->seen, ex->used); - if (ex->e->store_status == STORE_ABORTED) { - debug(38, 3) ("netdbExchangeHandleReply: STORE_ABORTED\n"); + if (EBIT_TEST(ex->e->flags, ENTRY_ABORTED)) { + debug(38, 3) ("netdbExchangeHandleReply: ENTRY_ABORTED\n"); netdbExchangeDone(ex); } else if (ex->e->store_status == STORE_PENDING) { debug(38, 3) ("netdbExchangeHandleReply: STORE_PENDING\n"); diff --git a/src/peer_digest.cc b/src/peer_digest.cc index db40e2d45e..00af1f49b2 100644 --- a/src/peer_digest.cc +++ b/src/peer_digest.cc @@ -1,6 +1,6 @@ /* - * $Id: peer_digest.cc,v 1.68 1998/12/16 05:38:57 wessels Exp $ + * $Id: peer_digest.cc,v 1.69 1999/01/11 16:50:36 wessels Exp $ * * DEBUG: section 72 Peer Digest Routines * AUTHOR: Alex Rousskov @@ -540,7 +540,7 @@ peerDigestFetchedEnough(DigestFetchState * fetch, char *buf, ssize_t size, const reason = "swap failure"; else if (!fetch->entry) reason = "swap aborted?!"; - else if (fetch->entry->store_status == STORE_ABORTED) + else if (EBIT_TEST(fetch->entry->flags, ENTRY_ABORTED)) reason = "swap aborted"; } /* continue checking (maybe-successful eof case) */ diff --git a/src/protos.h b/src/protos.h index 945b7ab237..bf3e6a3dc7 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.297 1998/12/16 06:04:17 wessels Exp $ + * $Id: protos.h,v 1.298 1999/01/11 16:50:37 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -647,7 +647,6 @@ extern void peerDigestStatsReport(const PeerDigest * pd, StoreEntry * e); extern void fwdStart(int, StoreEntry *, request_t *, struct in_addr); extern DEFER fwdCheckDeferRead; extern void fwdFail(FwdState *, int, http_status, int); -extern STABH fwdAbort; extern void fwdUnregister(int fd, FwdState *); extern void fwdComplete(FwdState * fwdState); extern void fwdInit(void); diff --git a/src/stat.cc b/src/stat.cc index cba42f81bf..8bf640dc89 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.304 1999/01/08 21:19:43 wessels Exp $ + * $Id: stat.cc,v 1.305 1999/01/11 16:50:39 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -301,7 +301,7 @@ statObjects(void *data) storeUnlockObject(state->sentry); cbdataFree(state); return; - } else if (state->sentry->store_status == STORE_ABORTED) { + } else if (EBIT_TEST(state->sentry->flags, ENTRY_ABORTED)) { storeUnlockObject(state->sentry); cbdataFree(state); return; diff --git a/src/store.cc b/src/store.cc index fe590a8bf0..5ae2465568 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.475 1998/12/05 00:54:43 wessels Exp $ + * $Id: store.cc,v 1.476 1999/01/11 16:50:41 wessels Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -56,8 +56,7 @@ const char *pingStatusStr[] = const char *storeStatusStr[] = { "STORE_OK", - "STORE_PENDING", - "STORE_ABORTED" + "STORE_PENDING" }; const char *swapStatusStr[] = @@ -250,10 +249,8 @@ storeUnlockObject(StoreEntry * e) storeKeyText(e->key), e->lock_count); if (e->lock_count) return (int) e->lock_count; - if (e->store_status == STORE_PENDING) { - assert(!EBIT_TEST(e->flags, ENTRY_DISPATCHED)); + if (e->store_status == STORE_PENDING) EBIT_SET(e->flags, RELEASE_REQUEST); - } assert(storePendingNClients(e) == 0); if (EBIT_TEST(e->flags, RELEASE_REQUEST)) storeRelease(e); @@ -596,7 +593,7 @@ storeAbort(StoreEntry * e, int cbflag) storeLockObject(e); /* lock while aborting */ storeNegativeCache(e); storeReleaseRequest(e); - e->store_status = STORE_ABORTED; + EBIT_SET(e->flags, ENTRY_ABORTED); storeSetMemStatus(e, NOT_IN_MEMORY); /* No DISK swap for negative cached object */ e->swap_status = SWAPOUT_NONE; @@ -1051,7 +1048,7 @@ storeEntryValidToSend(StoreEntry * e) if (EBIT_TEST(e->flags, ENTRY_NEGCACHED)) if (e->expires <= squid_curtime) return 0; - if (e->store_status == STORE_ABORTED) + if (EBIT_TEST(e->flags, ENTRY_ABORTED)) return 0; return 1; } diff --git a/src/store_client.cc b/src/store_client.cc index 7648e702bf..1133bf84cf 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -1,6 +1,6 @@ /* - * $Id: store_client.cc,v 1.51 1999/01/08 22:07:54 wessels Exp $ + * $Id: store_client.cc,v 1.52 1999/01/11 16:50:42 wessels Exp $ * * DEBUG: section 20 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -81,9 +81,9 @@ storeClientType(StoreEntry * e) MemObject *mem = e->mem_obj; if (mem->inmem_lo) return STORE_DISK_CLIENT; - if (e->store_status == STORE_ABORTED) { + if (EBIT_TEST(e->flags, ENTRY_ABORTED)) { /* I don't think we should be adding clients to aborted entries */ - debug(20, 1) ("storeClientType: adding to STORE_ABORTED entry\n"); + debug(20, 1) ("storeClientType: adding to ENTRY_ABORTED entry\n"); return STORE_MEM_CLIENT; } if (e->store_status == STORE_OK) { @@ -156,7 +156,7 @@ storeClientCopy(StoreEntry * e, void *data) { store_client *sc; - assert(e->store_status != STORE_ABORTED); + assert(!EBIT_TEST(e->flags, ENTRY_ABORTED)); debug(20, 3) ("storeClientCopy: %s, seen %d, want %d, size %d, cb %p, cbdata %p\n", storeKeyText(e->key), (int) seen_offset, @@ -179,7 +179,7 @@ storeClientCopy(StoreEntry * e, /* * This function is used below to decide if we have any more data to * send to the client. If the store_status is STORE_PENDING, then we - * do have more data to send. If its STORE_OK or STORE_ABORTED, then + * do have more data to send. If its STORE_OK, then * we continue checking. If the object length is negative, then we * don't know the real length and must open the swap file to find out. * If the length is >= 0, then we compare it to the requested copy @@ -221,7 +221,7 @@ storeClientCopy2(StoreEntry * e, store_client * sc) debug(20, 3) ("storeClientCopy2: %s\n", storeKeyText(e->key)); assert(callback != NULL); /* - * We used to check for STORE_ABORTED here. But there were some + * We used to check for ENTRY_ABORTED here. But there were some * problems. For example, we might have a slow client (or two) and * the server-side is reading far ahead and swapping to disk. Even * if the server-side aborts, we want to give the client(s) @@ -530,11 +530,11 @@ CheckQuickAbort2(StoreEntry * entry) assert(mem); debug(20, 3) ("CheckQuickAbort2: entry=%p, mem=%p\n", entry, mem); if (mem->request && !mem->request->flags.cachable) { - debug(20, 3) ("CheckQuickAbort2: YES !mem->request->flags.cachable\n"); + debug(20, 1) ("CheckQuickAbort2: YES !mem->request->flags.cachable\n"); return 1; } if (EBIT_TEST(entry->flags, KEY_PRIVATE)) { - debug(20, 3) ("CheckQuickAbort2: YES KEY_PRIVATE\n"); + debug(20, 1) ("CheckQuickAbort2: YES KEY_PRIVATE\n"); return 1; } expectlen = mem->reply->content_length; @@ -545,7 +545,7 @@ CheckQuickAbort2(StoreEntry * entry) return 0; } if (curlen > expectlen) { - debug(20, 3) ("CheckQuickAbort2: YES bad content length\n"); + debug(20, 1) ("CheckQuickAbort2: YES bad content length\n"); return 1; } if ((expectlen - curlen) < minlen) { @@ -553,7 +553,7 @@ CheckQuickAbort2(StoreEntry * entry) return 0; } if ((expectlen - curlen) > (Config.quickAbort.max << 10)) { - debug(20, 3) ("CheckQuickAbort2: YES too much left to go\n"); + debug(20, 1) ("CheckQuickAbort2: YES too much left to go\n"); return 1; } if (expectlen < 100) { @@ -564,7 +564,7 @@ CheckQuickAbort2(StoreEntry * entry) debug(20, 3) ("CheckQuickAbort2: NO past point of no return\n"); return 0; } - debug(20, 3) ("CheckQuickAbort2: YES default, returning 1\n"); + debug(20, 1) ("CheckQuickAbort2: YES default, returning 1\n"); return 1; } diff --git a/src/store_swapout.cc b/src/store_swapout.cc index 6ce99cb29a..91219356d2 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.cc,v 1.40 1999/01/08 21:12:17 wessels Exp $ + * $Id: store_swapout.cc,v 1.41 1999/01/11 16:50:43 wessels Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -141,7 +141,7 @@ storeCheckSwapOut(StoreEntry * e) debug(20, 7) ("storeCheckSwapOut: %s\n", storeUrl(e)); debug(20, 7) ("storeCheckSwapOut: store_status = %s\n", storeStatusStr[e->store_status]); - if (e->store_status == STORE_ABORTED) { + if (EBIT_TEST(e->flags, ENTRY_ABORTED)) { assert(EBIT_TEST(e->flags, RELEASE_REQUEST)); storeSwapOutFileClose(e); return; diff --git a/src/urn.cc b/src/urn.cc index c71200658f..a462d41403 100644 --- a/src/urn.cc +++ b/src/urn.cc @@ -1,7 +1,7 @@ /* * - * $Id: urn.cc,v 1.49 1998/12/05 00:54:48 wessels Exp $ + * $Id: urn.cc,v 1.50 1999/01/11 16:50:43 wessels Exp $ * * DEBUG: section 52 URN Parsing * AUTHOR: Kostas Anagnostakis @@ -191,7 +191,7 @@ urnHandleReply(void *data, char *buf, ssize_t size) int urlcnt = 0; debug(52, 3) ("urnHandleReply: Called with size=%d.\n", size); - if (urlres_e->store_status == STORE_ABORTED) { + if (EBIT_TEST(urlres_e->flags, ENTRY_ABORTED)) { memFree(buf, MEM_4K_BUF); return; }