--------------------- PatchSet 5517 Date: 2002/11/29 08:21:13 Author: ymc Branch: dsa Tag: (none) Log: fixed mimeInit problem Members: src/mime.c:1.3.4.3.10.1->1.3.4.3.10.2 src/store.c:1.4.4.5.6.2->1.4.4.5.6.3 src/store_swapout.c:1.4.4.2.4.3->1.4.4.2.4.4 Index: squid/src/mime.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/mime.c,v retrieving revision 1.3.4.3.10.1 retrieving revision 1.3.4.3.10.2 diff -u -r1.3.4.3.10.1 -r1.3.4.3.10.2 --- squid/src/mime.c 15 Nov 2002 09:10:34 -0000 1.3.4.3.10.1 +++ squid/src/mime.c 29 Nov 2002 08:21:13 -0000 1.3.4.3.10.2 @@ -1,6 +1,6 @@ /* - * $Id: mime.c,v 1.3.4.3.10.1 2002/11/15 09:10:34 ymc Exp $ + * $Id: mime.c,v 1.3.4.3.10.2 2002/11/29 08:21:13 ymc Exp $ * * DEBUG: section 25 MIME Parsing * AUTHOR: Harvest Derived @@ -393,6 +393,8 @@ struct stat sb; #ifdef DSA InstanceEntry *e; + StoreEntry * p = NULL; + cache_key digest[MD5_DIGEST_CHARS]; #else StoreEntry *e; #endif @@ -406,7 +408,11 @@ fatal("Unknown icon format while reading mime.conf\n"); buf = internalLocalUri("/squid-internal-static/icons/", icon); xstrncpy(url, buf, MAX_URL); +#ifdef DSA + if (instanceGetPublic(url, METHOD_GET)) +#else if (storeGetPublic(url, METHOD_GET)) +#endif return; snprintf(path, MAXPATHLEN, "%s/%s", Config.icons.directory, icon); fd = file_open(path, O_RDONLY | O_BINARY); @@ -454,21 +460,37 @@ #endif /* read the file into the buffer and append it to store */ buf = memAllocate(MEM_4K_BUF); - while ((n = read(fd, buf, 4096)) > 0) #ifdef DSA + while ((n = read(fd, buf, 4096)) > 0) { + MD5Update(&e->p->ctx, buf, n); storeAppend(e->p, buf, n); + } + MD5Final(digest, &e->p->ctx); + p = storeGet(digest); + if (p == NULL) { + EBIT_CLR(e->p->flags, KEY_PRIVATE); + storeHashInsert(e->p, digest); + EBIT_SET(e->flags, ENTRY_SPECIAL); + EBIT_SET(e->p->flags, ENTRY_SPECIAL); + storeBufferFlush(e->p); + storeComplete(e->p); + } + else { + EBIT_SET(e->flags, ENTRY_SPECIAL); + EBIT_SET(e->p->flags, ENTRY_SPECIAL); + storeBufferFlush(e->p); + storeComplete(e->p); + storeUnlink(e->p); + storeRelease(e->p); + e->p = p; + } #else + while ((n = read(fd, buf, 4096)) > 0) storeAppend(e, buf, n); #endif file_close(fd); EBIT_SET(e->flags, ENTRY_SPECIAL); -#ifdef DSA - storeBufferFlush(e->p); - storeComplete(e->p); - storeTimestampsSet(e); - debug(25, 3) ("Loaded icon %s\n", url); - storeUnlockObject(e->p); -#else +#ifndef DSA storeBufferFlush(e); storeComplete(e); storeTimestampsSet(e); Index: squid/src/store.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store.c,v retrieving revision 1.4.4.5.6.2 retrieving revision 1.4.4.5.6.3 diff -u -r1.4.4.5.6.2 -r1.4.4.5.6.3 --- squid/src/store.c 18 Nov 2002 05:06:02 -0000 1.4.4.5.6.2 +++ squid/src/store.c 29 Nov 2002 08:21:13 -0000 1.4.4.5.6.3 @@ -1,6 +1,6 @@ /* - * $Id: store.c,v 1.4.4.5.6.2 2002/11/18 05:06:02 ymc Exp $ + * $Id: store.c,v 1.4.4.5.6.3 2002/11/29 08:21:13 ymc Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -1376,6 +1376,10 @@ storeInitHashValues(); store_table = hash_create(storeKeyHashCmp, store_hash_buckets, storeKeyHashHash); +#ifdef DSA + instance_table = hash_create(storeKeyHashCmp, + store_hash_buckets, storeKeyHashHash); +#endif mem_policy = createRemovalPolicy(Config.memPolicy); storeDigestInit(); storeLogOpen(); @@ -1429,6 +1433,10 @@ void storeFreeMemory(void) { +#ifdef DSA + hashFreeMemory(instance_table); + instance_table = NULL; +#endif hashFreeItems(store_table, destroy_StoreEntry); hashFreeMemory(store_table); store_table = NULL; Index: squid/src/store_swapout.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_swapout.c,v retrieving revision 1.4.4.2.4.3 retrieving revision 1.4.4.2.4.4 diff -u -r1.4.4.2.4.3 -r1.4.4.2.4.4 --- squid/src/store_swapout.c 18 Nov 2002 07:39:51 -0000 1.4.4.2.4.3 +++ squid/src/store_swapout.c 29 Nov 2002 08:21:13 -0000 1.4.4.2.4.4 @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.c,v 1.4.4.2.4.3 2002/11/18 07:39:51 ymc Exp $ + * $Id: store_swapout.c,v 1.4.4.2.4.4 2002/11/29 08:21:13 ymc Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -169,8 +169,9 @@ * for the most part, we treat swapable == cachable here. */ #ifdef DSA - assert(e->instances->count == 1); - instanceReleaseRequest((InstanceEntry *) e->instances->items[0]); +// assert(e->instances->count == 1); +// instanceReleaseRequest((InstanceEntry *) e->instances->items[0]); + storeReleaseRequest(e); #else storeReleaseRequest(e); #endif