--------------------- PatchSet 4874 Date: 2007/06/25 13:09:00 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: Drop ipcache locks not really needed and causing loops in ipcache linked-lists Members: src/ipcache.cc:1.9.2.31->1.9.2.32 Index: squid3/src/ipcache.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ipcache.cc,v retrieving revision 1.9.2.31 retrieving revision 1.9.2.32 diff -u -r1.9.2.31 -r1.9.2.32 --- squid3/src/ipcache.cc 25 Jun 2007 12:22:06 -0000 1.9.2.31 +++ squid3/src/ipcache.cc 25 Jun 2007 13:09:00 -0000 1.9.2.32 @@ -1,6 +1,6 @@ /* - * $Id: ipcache.cc,v 1.9.2.31 2007/06/25 12:22:06 amosjeffries Exp $ + * $Id: ipcache.cc,v 1.9.2.32 2007/06/25 13:09:00 amosjeffries Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -442,9 +442,6 @@ debugs(14, 5, "ipcacheParse: CNAME " << answers[k].rdata << " already has " << res->count << " IPs cached."); } else { - /* lock this object for changes until CNAME loop releases it. */ - ipcacheLockEntry(i); - /* keep going on this, but flag the fact that we need to wait for more IPs */ debugs(14, 5, "ipcacheParse: CNAME " << answers[k].rdata << " has no IPs! Recursing."); ipcache_nbgethostbyname(answers[k].rdata, ipcacheHandleCnameRecurse, new generic_cbdata(i) ); @@ -720,6 +717,7 @@ ipcacheStatPrint(ipcache_entry * i, StoreEntry * sentry) { int k; + int count = i->addrs.count; char buf[MAX_IPSTRLEN]; storeAppendPrintf(sentry, " %-32.32s %c%c %6d %6d %2d(%2d)", @@ -731,10 +729,17 @@ (int) i->addrs.count, (int) i->addrs.badcount); - for (k = 0; k < (int) i->addrs.count; k++) { - storeAppendPrintf(sentry, " %45s-%3s", i->addrs.in_addrs[k].NtoA(buf,MAX_IPSTRLEN), - i->addrs.bad_mask[k] ? "BAD" : "OK "); - /* Max. between 15 IPv4 / 45 IPv6 address length */ + for (k = 0; k < count; k++) { + /* Display tidy-up: IPv6 are so big make the list vertical */ + if(k == 0) + storeAppendPrintf(sentry, " %45s-%3s", + i->addrs.in_addrs[k].NtoA(buf,MAX_IPSTRLEN), + i->addrs.bad_mask[k] ? "BAD" : "OK "); + else + storeAppendPrintf(sentry, "%50s %45s-%3s", + " ", /* blank-space indenting IP list */ + i->addrs.in_addrs[k].NtoA(buf,MAX_IPSTRLEN), + i->addrs.bad_mask[k] ? "BAD" : "OK "); } storeAppendPrintf(sentry, "\n"); @@ -759,12 +764,12 @@ IpcacheStats.misses); storeAppendPrintf(sentry, "\n\n"); storeAppendPrintf(sentry, "IP Cache Contents:\n\n"); - storeAppendPrintf(sentry, " %-29.29s %3s %6s %6s %1s\n", + storeAppendPrintf(sentry, " %-31.31s %3s %6s %6s %4s\n", "Hostname", "Flg", "lstref", "TTL", - "N"); + "N(b)"); for (m = lru_list.head; m; m = m->next) ipcacheStatPrint((ipcache_entry *)m->data, sentry); @@ -866,9 +871,6 @@ i->error_message = xstrdup("No DNS Records"); } - /* unlock the parent object locked to prevent corruption during the recursion delay */ - ipcacheUnlockEntry(i); - /* finish the lookup we were doing on parent when we got side-tracked for CNAME loop */ ipcacheAddEntry(i); ipcacheCallback(i);