From 789f4e81cb1e0761e933d6486066f9e31611a10d Mon Sep 17 00:00:00 2001 From: wessels <> Date: Tue, 12 Jan 1999 22:47:51 +0000 Subject: [PATCH] server-side handlers check for ENTRY_ABORTED and close their FD pump.c needs FwdState to set fwdFail() --- src/ftp.cc | 9 ++++++--- src/gopher.cc | 6 +++++- src/http.cc | 8 ++++++-- src/protos.h | 4 ++-- src/store.cc | 4 +++- src/wais.cc | 6 +++++- 6 files changed, 27 insertions(+), 10 deletions(-) diff --git a/src/ftp.cc b/src/ftp.cc index 46b30bf0bb..db4a30f3fe 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.261 1999/01/11 20:28:02 wessels Exp $ + * $Id: ftp.cc,v 1.262 1999/01/12 15:47:51 wessels Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -836,6 +836,10 @@ 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 @@ -2210,8 +2214,7 @@ static void ftpPutStart(FtpStateData * ftpState) { debug(9, 3) ("ftpPutStart\n"); - pumpStart(ftpState->data.fd, ftpState->entry, - ftpState->request, ftpPutTransferDone, ftpState); + pumpStart(ftpState->data.fd, ftpState->fwd, ftpPutTransferDone, ftpState); } static void diff --git a/src/gopher.cc b/src/gopher.cc index 30b26dca8f..f26048716c 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -1,7 +1,7 @@ /* - * $Id: gopher.cc,v 1.142 1999/01/08 21:12:13 wessels Exp $ + * $Id: gopher.cc,v 1.143 1999/01/12 15:47:52 wessels Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -599,6 +599,10 @@ 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 88c9fee7cb..86361d5612 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.336 1999/01/11 16:50:32 wessels Exp $ + * $Id: http.cc,v 1.337 1999/01/12 15:47:53 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -430,6 +430,10 @@ 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; @@ -920,5 +924,5 @@ httpSendRequestEntry(int fd, char *bufnotused, size_t size, int errflag, void *d comm_close(fd); return; } - pumpStart(fd, entry, httpState->orig_request, httpSendComplete, httpState); + pumpStart(fd, httpState->fwd, httpSendComplete, httpState); } diff --git a/src/protos.h b/src/protos.h index a259d182e2..df649b2f5f 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.300 1999/01/11 22:54:20 wessels Exp $ + * $Id: protos.h,v 1.301 1999/01/12 15:47:54 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -966,7 +966,7 @@ extern void PrintRusage(void); extern void dumpMallocStats(void); extern void pumpInit(int fd, request_t * r, char *uri); -extern void pumpStart(int, StoreEntry *, request_t *, CWCB * callback, void *); +extern void pumpStart(int, FwdState *, CWCB * callback, void *); extern int pumpMethod(method_t method); extern int pumpRestart(request_t *); diff --git a/src/store.cc b/src/store.cc index 294ba834ce..a9fe594f9a 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.477 1999/01/11 21:55:43 wessels Exp $ + * $Id: store.cc,v 1.478 1999/01/12 15:47:56 wessels Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -399,6 +399,7 @@ storeAppend(StoreEntry * e, const char *buf, int len) MemObject *mem = e->mem_obj; assert(mem != NULL); assert(len >= 0); + assert(e->store_status == STORE_PENDING); if (len) { debug(20, 5) ("storeAppend: appending %d bytes for '%s'\n", len, @@ -597,6 +598,7 @@ storeAbort(StoreEntry * e, int cbflag) storeSetMemStatus(e, NOT_IN_MEMORY); /* No DISK swap for negative cached object */ e->swap_status = SWAPOUT_NONE; + e->store_status = STORE_OK; /* * We assign an object length here. The only other place we assign * the object length is in storeComplete() diff --git a/src/wais.cc b/src/wais.cc index 6b85ea0288..d86ff290b4 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -1,6 +1,6 @@ /* - * $Id: wais.cc,v 1.124 1998/12/05 00:54:48 wessels Exp $ + * $Id: wais.cc,v 1.125 1999/01/12 15:47:57 wessels Exp $ * * DEBUG: section 24 WAIS Relay * AUTHOR: Harvest Derived @@ -91,6 +91,10 @@ 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 -- 2.47.3