From: wessels <> Date: Tue, 23 May 2006 06:30:21 +0000 (+0000) Subject: Added "self" refcounted Pointer parameters to StoreIOState's STRCB, STFNCB, X-Git-Tag: SQUID_3_0_PRE4~105 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e5de8b133846bef451ffbf315ea35520e32f1791;p=thirdparty%2Fsquid.git Added "self" refcounted Pointer parameters to StoreIOState's STRCB, STFNCB, and STIOCB callback functions. This is so that the StoreIOState refcount doesn't go to zero during one of these callbacks. --- diff --git a/src/StoreIOState.h b/src/StoreIOState.h index 63f1dc9c7d..95353a9ba0 100644 --- a/src/StoreIOState.h +++ b/src/StoreIOState.h @@ -1,6 +1,6 @@ /* - * $Id: StoreIOState.h,v 1.8 2006/05/23 00:21:47 wessels Exp $ + * $Id: StoreIOState.h,v 1.9 2006/05/23 00:30:21 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -48,7 +48,7 @@ public: * storeClientReadBody * storeClientReadHeader */ - typedef void STRCB(void *their_data, const char *buf, ssize_t len); + typedef void STRCB(void *their_data, const char *buf, ssize_t len, StoreIOState::Pointer self); /* * STFNCB is the "store file number callback." It is called @@ -60,7 +60,7 @@ public: * storeSwapInFileNotify * storeSwapOutFileNotify */ - typedef void STFNCB(void *their_data, int errflag); + typedef void STFNCB(void *their_data, int errflag, StoreIOState::Pointer self); /* * STIOCB is the "store close callback" for store files. It @@ -70,7 +70,7 @@ public: * storeSwapOutFileClosed * storeSwapInFileClosed */ - typedef void STIOCB(void *their_data, int errflag); + typedef void STIOCB(void *their_data, int errflag, StoreIOState::Pointer self); /* StoreIOState does not get mempooled - it's children do */ void *operator new (size_t amount); diff --git a/src/fs/ufs/store_io_ufs.cc b/src/fs/ufs/store_io_ufs.cc index 5aa1b73ebb..2c3f32bb4d 100644 --- a/src/fs/ufs/store_io_ufs.cc +++ b/src/fs/ufs/store_io_ufs.cc @@ -1,6 +1,6 @@ /* - * $Id: store_io_ufs.cc,v 1.31 2006/05/23 00:21:48 wessels Exp $ + * $Id: store_io_ufs.cc,v 1.32 2006/05/23 00:30:21 wessels Exp $ * * DEBUG: section 79 Storage Manager UFS Interface * AUTHOR: Duane Wessels @@ -251,7 +251,7 @@ UFSStoreState::readCompleted(const char *buf, int len, int errflag, RefCount 0 && read_buf != buf) memcpy(read_buf, buf, len); - callback(cbdata, read_buf, len); + callback(cbdata, read_buf, len, this); } else if (closing && theFile.getRaw()!= NULL && !theFile->ioInProgress()) doCallback(errflag); } @@ -299,7 +299,7 @@ UFSStoreState::doCallback(int errflag) void *cbdata; if (cbdataReferenceValidDone(callback_data, &cbdata) && theCallback) - theCallback(cbdata, errflag); + theCallback(cbdata, errflag, this); /* We are finished with the file as this is on close or error only.*/ /* This must be the last line, as theFile may be the only object holding diff --git a/src/store_client.cc b/src/store_client.cc index 2ec96c2154..2a15b1968d 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -1,6 +1,6 @@ /* - * $Id: store_client.cc,v 1.145 2006/05/23 00:21:47 wessels Exp $ + * $Id: store_client.cc,v 1.146 2006/05/23 00:30:21 wessels Exp $ * * DEBUG: section 90 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -469,7 +469,7 @@ store_client::fileRead() } static void -storeClientReadBody(void *data, const char *buf, ssize_t len) +storeClientReadBody(void *data, const char *buf, ssize_t len, StoreIOState::Pointer self) { store_client *sc = (store_client *)data; assert(sc->flags.disk_io_pending); @@ -505,7 +505,7 @@ store_client::fail() } static void -storeClientReadHeader(void *data, const char *buf, ssize_t len) +storeClientReadHeader(void *data, const char *buf, ssize_t len, StoreIOState::Pointer self) { store_client *sc = (store_client *)data; sc->readHeader(buf, len); diff --git a/src/store_swapin.cc b/src/store_swapin.cc index cd2633bfe2..870e31317f 100644 --- a/src/store_swapin.cc +++ b/src/store_swapin.cc @@ -1,6 +1,6 @@ /* - * $Id: store_swapin.cc,v 1.38 2006/05/23 00:21:47 wessels Exp $ + * $Id: store_swapin.cc,v 1.39 2006/05/23 00:30:21 wessels Exp $ * * DEBUG: section 20 Storage Manager Swapin Functions * AUTHOR: Duane Wessels @@ -72,7 +72,7 @@ storeSwapInStart(store_client * sc) } static void -storeSwapInFileClosed(void *data, int errflag) +storeSwapInFileClosed(void *data, int errflag, StoreIOState::Pointer self) { store_client *sc = (store_client *)data; debug(20, 3) ("storeSwapInFileClosed: sio=%p, errflag=%d\n", @@ -88,7 +88,7 @@ storeSwapInFileClosed(void *data, int errflag) } static void -storeSwapInFileNotify(void *data, int errflag) +storeSwapInFileNotify(void *data, int errflag, StoreIOState::Pointer self) { store_client *sc = (store_client *)data; StoreEntry *e = sc->entry; diff --git a/src/store_swapout.cc b/src/store_swapout.cc index b6566cd5b9..6d205ba65b 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.cc,v 1.105 2006/05/23 00:21:47 wessels Exp $ + * $Id: store_swapout.cc,v 1.106 2006/05/23 00:30:21 wessels Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -100,7 +100,7 @@ storeSwapOutStart(StoreEntry * e) } static void -storeSwapOutFileNotify(void *data, int errflag) +storeSwapOutFileNotify(void *data, int errflag, StoreIOState::Pointer self) { generic_cbdata *c = (generic_cbdata *)data; StoreEntry *e = (StoreEntry *)c->data; @@ -316,7 +316,7 @@ storeSwapOutFileClose(StoreEntry * e) } static void -storeSwapOutFileClosed(void *data, int errflag) +storeSwapOutFileClosed(void *data, int errflag, StoreIOState::Pointer self) { generic_cbdata *c = (generic_cbdata *)data; StoreEntry *e = (StoreEntry *)c->data;