From 7d31d5fa33ea5befb1206a21b3022b1a49d3ba2d Mon Sep 17 00:00:00 2001 From: robertc <> Date: Sun, 18 May 2003 06:03:55 +0000 Subject: [PATCH] Summary: Various bugfixes. Keywords: * ACLChecklist::checkCallback: used deleteSelf() rather than delete this; * ClientRequestContext::~ClientRequestContext: ditto. * clientAccessCheckDone: Prevent race conditions leading to double deletes of acl_checklist. * comm_accept_check_event: Add comment for clarity. * StoreEntry::storeClientType: Add comments for clarity. * StoreEntry::complete(): Ditto. * Move .cci files to noinst_headers section. --- src/ACLChecklist.cc | 4 ++-- src/Makefile.am | 6 +++--- src/client_side_request.cc | 6 +++--- src/comm.cc | 3 ++- src/store.cc | 16 +++++++++++++++- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/ACLChecklist.cc b/src/ACLChecklist.cc index 38f88b5a03..663ada6df2 100644 --- a/src/ACLChecklist.cc +++ b/src/ACLChecklist.cc @@ -1,5 +1,5 @@ /* - * $Id: ACLChecklist.cc,v 1.11 2003/05/17 17:35:03 hno Exp $ + * $Id: ACLChecklist.cc,v 1.12 2003/05/18 00:04:07 robertc Exp $ * * DEBUG: section 28 Access Control * AUTHOR: Duane Wessels @@ -232,7 +232,7 @@ ACLChecklist::checkCallback(allow_t answer) if (cbdataReferenceValidDone(callback_data, &cbdata_)) callback_(answer, cbdata_); - delete this; + deleteSelf(); } void diff --git a/src/Makefile.am b/src/Makefile.am index 5fe2bbf3b2..43867fd3c2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.am,v 1.74 2003/05/17 17:35:03 hno Exp $ +# $Id: Makefile.am,v 1.75 2003/05/18 00:04:07 robertc Exp $ # # Uncomment and customize the following to suit your needs: # @@ -266,7 +266,6 @@ squid_SOURCES = \ acl.cc \ ACL.h \ ACLChecklist.cc \ - ACLChecklist.cci \ ACLChecklist.h \ $(squid_ACLSOURCES) \ asn.cc \ @@ -427,7 +426,8 @@ squid_SOURCES = \ whois.cc \ $(WIN32SOURCE) -noinst_HEADERS = MemBuf.cci \ +noinst_HEADERS = ACLChecklist.cci \ + MemBuf.cci \ MemBuf.h \ Store.cci \ String.cci \ diff --git a/src/client_side_request.cc b/src/client_side_request.cc index ea1cd3c586..16ee27747f 100644 --- a/src/client_side_request.cc +++ b/src/client_side_request.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_request.cc,v 1.21 2003/05/11 13:53:03 hno Exp $ + * $Id: client_side_request.cc,v 1.22 2003/05/18 00:04:07 robertc Exp $ * * DEBUG: section 85 Client-side Request Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -130,7 +130,7 @@ ClientRequestContext::~ClientRequestContext() cbdataReferenceDone(http); if (acl_checklist) - delete acl_checklist; + acl_checklist->deleteSelf(); } ClientRequestContext::ClientRequestContext() : acl_checklist (NULL), redirect_state (REDIRECT_NONE), http(NULL) @@ -379,6 +379,7 @@ clientAccessCheckDone(int answer, void *data) { ClientRequestContext *context = (ClientRequestContext *)data; + context->acl_checklist = NULL; clientHttpRequest *http_ = context->http; if (!cbdataReferenceValid (http_)) { @@ -397,7 +398,6 @@ clientAccessCheckDone(int answer, void *data) proxy_auth_msg = authenticateAuthUserRequestMessage((http->conn && http->conn->auth_user_request) ? http->conn-> auth_user_request : http->request->auth_user_request); - context->acl_checklist = NULL; if (answer == ACCESS_ALLOWED) { safe_free(http->uri); diff --git a/src/comm.cc b/src/comm.cc index 4a270de0b7..cdc34ddcef 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.374 2003/04/24 06:35:08 hno Exp $ + * $Id: comm.cc,v 1.375 2003/05/18 00:03:55 robertc Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -983,6 +983,7 @@ comm_accept_check_event(void *data) int fd = ((fdc_t *)(data))->fd; if (fdNFree() < RESERVED_FD) { + /* activate accept checking rather than period event based checks */ commSetSelect(fd, COMM_SELECT_READ, comm_accept_try, NULL, 0); return; } diff --git a/src/store.cc b/src/store.cc index 0623f59d8a..df058d9b2b 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.565 2003/03/15 04:17:41 robertc Exp $ + * $Id: store.cc,v 1.566 2003/05/18 00:04:07 robertc Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -236,6 +236,12 @@ StoreEntry::setNoDelay (bool const newValue) store_client_t StoreEntry::storeClientType() const { + /* The needed offset isn't in memory + * XXX TODO: this is wrong for range requests + * as the needed offset may *not* be 0, AND + * offset 0 in the memory object is the HTTP headers. + */ + if (mem_obj->inmem_lo) return STORE_DISK_CLIENT; @@ -246,7 +252,10 @@ StoreEntry::storeClientType() const } if (store_status == STORE_OK) { + /* the object has completed. */ + if (mem_obj->inmem_lo == 0 && !isEmpty()) + /* hot object */ return STORE_MEM_CLIENT; else return STORE_DISK_CLIENT; @@ -1000,8 +1009,13 @@ StoreEntry::complete() return; } + /* This is suspect: mem obj offsets include the headers. do we adjust for that + * in use of object_sz? + */ mem_obj->object_sz = mem_obj->endOffset(); + store_status = STORE_OK; + assert(mem_status == NOT_IN_MEMORY); if (!validLength()) { -- 2.47.3