--------------------- PatchSet 1113 Date: 2001/01/06 13:11:02 Author: adri Branch: modio Tag: (none) Log: Split up clientPurgeRequest() into two functions - clientStartPurgeRequest() initiates a storeLookup() for the required object, and clientPurgeRequest() is a static callback which deals with the storeLookup response. Members: src/client_side.c:1.2.2.10->1.2.2.11 src/protos.h:1.2.2.13->1.2.2.14 Index: squid/src/client_side.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/client_side.c,v retrieving revision 1.2.2.10 retrieving revision 1.2.2.11 diff -u -r1.2.2.10 -r1.2.2.11 --- squid/src/client_side.c 5 Jan 2001 15:33:10 -0000 1.2.2.10 +++ squid/src/client_side.c 6 Jan 2001 13:11:02 -0000 1.2.2.11 @@ -1,6 +1,6 @@ /* - * $Id: client_side.c,v 1.2.2.10 2001/01/05 15:33:10 adri Exp $ + * $Id: client_side.c,v 1.2.2.11 2001/01/06 13:11:02 adri Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -117,6 +117,7 @@ static int clientReplyBodyTooLarge(int clen); static int clientRequestBodyTooLarge(int clen); static void httpMemFree(void *, int); +static STGETDONE clientPurgeRequest; static void httpMemFree(void *data, int notused) @@ -589,13 +590,10 @@ } void -clientPurgeRequest(clientHttpRequest * http) +clientStartPurgeRequest(clientHttpRequest * http) { - StoreEntry *entry; ErrorState *err = NULL; - HttpReply *r; - http_status status; - http_version_t version; + debug(33, 3) ("Config2.onoff.enable_purge = %d\n", Config2.onoff.enable_purge); if (!Config2.onoff.enable_purge) { http->log_type = LOG_TCP_DENIED; @@ -610,7 +608,19 @@ http->log_type = LOG_TCP_MISS; /* Release both IP and object cache entries */ ipcacheInvalidate(http->request->host); - if ((entry = storeGetPublic(http->uri, METHOD_GET)) == NULL) { + /* Initiate a lookup to try and get said object */ + storeLookup(http->uri, METHOD_GET, clientPurgeRequest, http); +} + +static void +clientPurgeRequest(void *data, StoreEntry *entry) +{ + clientHttpRequest *http = data; + HttpReply *r; + http_status status; + http_version_t version; + + if (entry == NULL) { status = HTTP_NOT_FOUND; } else { storeRelease(entry); @@ -2039,7 +2049,7 @@ #endif if (NULL == e) { /* this object isn't in the cache */ - debug(33, 3) ("clientProcessRequest2: storeGet() MISS\n"); + debug(33, 3) ("clientProcessRequest2: storeLookup() MISS\n"); return LOG_TCP_MISS; } if (Config.onoff.offline) { @@ -2117,7 +2127,7 @@ sslStart(fd, url, r, &http->out.size, &http->al.http.code); return; } else if (r->method == METHOD_PURGE) { - clientPurgeRequest(http); + clientStartPurgeRequest(http); return; } else if (r->method == METHOD_TRACE) { if (r->max_forwards == 0) { Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/protos.h,v retrieving revision 1.2.2.13 retrieving revision 1.2.2.14 diff -u -r1.2.2.13 -r1.2.2.14 --- squid/src/protos.h 5 Jan 2001 15:33:11 -0000 1.2.2.13 +++ squid/src/protos.h 6 Jan 2001 13:11:02 -0000 1.2.2.14 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.2.2.13 2001/01/05 15:33:11 adri Exp $ + * $Id: protos.h,v 1.2.2.14 2001/01/06 13:11:02 adri Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -111,7 +111,7 @@ extern void clientAccessCheckDone(int, void *); extern int modifiedSince(StoreEntry *, request_t *); extern char *clientConstructTraceEcho(clientHttpRequest *); -extern void clientPurgeRequest(clientHttpRequest *); +extern void clientStartPurgeRequest(clientHttpRequest *); extern int checkNegativeHit(StoreEntry *); extern void clientHttpConnectionsOpen(void); extern void clientHttpConnectionsClose(void);