From: wessels <> Date: Wed, 13 Jan 1999 06:37:41 +0000 (+0000) Subject: - removed storeAbort callback-server side argument X-Git-Tag: SQUID_3_0_PRE1~2416 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7197b20d337c6c095ec356c442651bdc4ff514a7;p=thirdparty%2Fsquid.git - removed storeAbort callback-server side argument - removed _fde->mode, I guess it was a bad idea anyway - removed recently added ENTRY_ABORTED checks in server modules - replaced fwdAbort() - fixed a mem_obj->request == NULL bug when fwdStart() returns 503 service unavailable. --- diff --git a/src/fd.cc b/src/fd.cc index be6c81c2d8..f4d7cb0fd6 100644 --- a/src/fd.cc +++ b/src/fd.cc @@ -1,6 +1,6 @@ /* - * $Id: fd.cc,v 1.29 1999/01/12 16:42:18 wessels Exp $ + * $Id: fd.cc,v 1.30 1999/01/12 23:37:41 wessels Exp $ * * DEBUG: section 51 Filedescriptor Functions * AUTHOR: Duane Wessels @@ -97,7 +97,7 @@ fd_open(int fd, unsigned int type, const char *desc) { fde *F = &fd_table[fd]; assert(fd >= 0); - if (!F->flags.open) { + if (F->flags.open) { debug(51, 1) ("WARNING: Closing open FD %4d\n", fd); fd_close(fd); } @@ -150,8 +150,10 @@ fdDumpOpen(void) continue; if (i == fileno(debug_log)) continue; - debug(51, 1) ("Open FD %s %4d %s\n", - F->type == FD_READ ? "reading" : "writing", + debug(51, 1) ("Open FD %-10s %4d %s\n", + F->bytes_read && F->bytes_written ? "READ/WRITE" : + F->bytes_read ? "READING" : + F->bytes_written ? "WRITING" : null_string, i, F->desc); } } diff --git a/src/forward.cc b/src/forward.cc index 1be1cab944..276db3aab3 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -1,6 +1,6 @@ /* - * $Id: forward.cc,v 1.43 1999/01/11 23:29:42 wessels Exp $ + * $Id: forward.cc,v 1.44 1999/01/12 23:37:42 wessels Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -48,6 +48,7 @@ static int fwdReforward(FwdState *); static void fwdStartFail(FwdState *); static void fwdLogReplyStatus(int tries, http_status status); static OBJH fwdStats; +static STABH fwdAbort; #define MAX_FWD_STATS_IDX 9 static int FwdReplyCodes[MAX_FWD_STATS_IDX + 1][HTTP_INVALID_HEADER + 1]; @@ -396,6 +397,9 @@ fwdStart(int fd, StoreEntry * e, request_t * r, struct in_addr client_addr) return; } } + debug(17, 3) ("fwdStart: '%s'\n", storeUrl(e)); + e->mem_obj->request = requestLink(r); + e->mem_obj->fd = fd; if (shutting_down) { /* more yuck */ err = errorCon(ERR_SHUTTING_DOWN, HTTP_SERVICE_UNAVAILABLE); @@ -403,9 +407,6 @@ fwdStart(int fd, StoreEntry * e, request_t * r, struct in_addr client_addr) errorAppendEntry(e, err); return; } - debug(17, 3) ("fwdStart: '%s'\n", storeUrl(e)); - e->mem_obj->request = requestLink(r); - e->mem_obj->fd = fd; switch (r->protocol) { /* * Note, don't create fwdState for these requests @@ -430,6 +431,7 @@ 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); } @@ -462,6 +464,17 @@ 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 */ diff --git a/src/ftp.cc b/src/ftp.cc index db4a30f3fe..1f75a241d3 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.262 1999/01/12 15:47:51 wessels Exp $ + * $Id: ftp.cc,v 1.263 1999/01/12 23:37:43 wessels Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -836,10 +836,6 @@ ftpDataRead(int fd, void *data) delay_id delay_id = delayMostBytesAllowed(mem); #endif assert(fd == ftpState->data.fd); - if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { - comm_close(fd); - 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 f26048716c..8c6b7053e8 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -1,7 +1,7 @@ /* - * $Id: gopher.cc,v 1.143 1999/01/12 15:47:52 wessels Exp $ + * $Id: gopher.cc,v 1.144 1999/01/12 23:37:45 wessels Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -599,10 +599,6 @@ gopherReadReply(int fd, void *data) #if DELAY_POOLS delay_id delay_id = delayMostBytesAllowed(entry->mem_obj); #endif - if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { - 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 86361d5612..8c093bf408 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.337 1999/01/12 15:47:53 wessels Exp $ + * $Id: http.cc,v 1.338 1999/01/12 23:37:46 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -430,10 +430,6 @@ httpReadReply(int fd, void *data) #if DELAY_POOLS delay_id delay_id = delayMostBytesAllowed(entry->mem_obj); #endif - if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { - comm_close(fd); - return; - } /* check if we want to defer reading */ errno = 0; read_sz = SQUID_TCP_SO_RCVBUF; diff --git a/src/protos.h b/src/protos.h index df649b2f5f..3ca6e01da0 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.301 1999/01/12 15:47:54 wessels Exp $ + * $Id: protos.h,v 1.302 1999/01/12 23:37:47 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -761,7 +761,7 @@ extern void storeSetPublicKey(StoreEntry *); extern void storeComplete(StoreEntry *); extern void storeInit(void); extern int storeClientWaiting(const StoreEntry *); -extern void storeAbort(StoreEntry *, int); +extern void storeAbort(StoreEntry *); extern void storeAppend(StoreEntry *, const char *, int); extern void storeLockObject(StoreEntry *); extern void storeSwapInStart(StoreEntry *, SIH *, void *data); diff --git a/src/store.cc b/src/store.cc index f07536abd7..0e51b3b09d 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.480 1999/01/12 16:23:22 wessels Exp $ + * $Id: store.cc,v 1.481 1999/01/12 23:37:49 wessels Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -591,7 +591,7 @@ storeComplete(StoreEntry * e) * entry for releasing */ void -storeAbort(StoreEntry * e, int cbflag) +storeAbort(StoreEntry * e) { MemObject *mem = e->mem_obj; STABH *callback; @@ -613,7 +613,7 @@ storeAbort(StoreEntry * e, int cbflag) */ mem->object_sz = mem->inmem_hi; /* Notify the server side */ - if (cbflag && mem->abort.callback) { + if (mem->abort.callback) { callback = mem->abort.callback; data = mem->abort.data; mem->abort.callback = NULL; diff --git a/src/store_client.cc b/src/store_client.cc index 1133bf84cf..5495beef0f 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -1,6 +1,6 @@ /* - * $Id: store_client.cc,v 1.52 1999/01/11 16:50:42 wessels Exp $ + * $Id: store_client.cc,v 1.53 1999/01/12 23:37:50 wessels Exp $ * * DEBUG: section 20 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -580,5 +580,5 @@ CheckQuickAbort(StoreEntry * entry) if (CheckQuickAbort2(entry) == 0) return; Counter.aborted_requests++; - storeAbort(entry, 1); + storeAbort(entry); } diff --git a/src/store_swapout.cc b/src/store_swapout.cc index 91219356d2..60e3a912df 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.cc,v 1.41 1999/01/11 16:50:43 wessels Exp $ + * $Id: store_swapout.cc,v 1.42 1999/01/12 23:37:51 wessels Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -156,7 +156,7 @@ storeCheckSwapOut(StoreEntry * e) (int) mem->swapout.done_offset); #if USE_ASYNC_IO if (mem->inmem_hi < mem->swapout.queue_offset) { - storeAbort(e, 0); + storeAbort(e); assert(EBIT_TEST(e->flags, RELEASE_REQUEST)); storeSwapOutFileClose(e); return; diff --git a/src/structs.h b/src/structs.h index ab077c35b1..2fb1a5ebd1 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,7 +1,7 @@ /* - * $Id: structs.h,v 1.257 1999/01/12 16:42:20 wessels Exp $ + * $Id: structs.h,v 1.258 1999/01/12 23:37:52 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -491,7 +491,6 @@ struct _ETag { struct _fde { unsigned int type; - unsigned int mode; /* FD_READ|FD_WRITE */ u_short local_port; u_short remote_port; char ipaddr[16]; /* dotted decimal address of peer */ diff --git a/src/wais.cc b/src/wais.cc index d86ff290b4..f22569943f 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -1,6 +1,6 @@ /* - * $Id: wais.cc,v 1.125 1999/01/12 15:47:57 wessels Exp $ + * $Id: wais.cc,v 1.126 1999/01/12 23:37:53 wessels Exp $ * * DEBUG: section 24 WAIS Relay * AUTHOR: Harvest Derived @@ -91,10 +91,6 @@ waisReadReply(int fd, void *data) #if DELAY_POOLS delay_id delay_id = delayMostBytesAllowed(entry->mem_obj); #endif - if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) { - comm_close(fd); - return; - } errno = 0; read_sz = 4096; #if DELAY_POOLS