aboutsummaryrefslogtreecommitdiff
path: root/src/or/dns.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-02-08 22:07:56 +0000
committerNick Mathewson <nickm@torproject.org>2007-02-08 22:07:56 +0000
commite00a1cbf16d04f8c66320e599ae383753f590f09 (patch)
treeccece7691f4b9ca02e91d723bea266800177f00c /src/or/dns.c
parent90b53beec5ba4ea19f144c17a5bbe7936e0c49c5 (diff)
downloadtor-e00a1cbf16d04f8c66320e599ae383753f590f09.tar.gz
tor-e00a1cbf16d04f8c66320e599ae383753f590f09.zip
r11726@catbus: nickm | 2007-02-08 16:04:53 -0500
Resolve some XXXX012 items: - Remove PathlenCoinWeight: if we want it again, we can add it back in. - Ditto with RelayBandwidth*. - Decide to leave in the "hey, you didn't set end_reason!" BUG log message, but stop telling people to bug me personally. - Postpone strengthening assert_connection_ok(): it's important, but it's also a good way to introduce weird bugs. - Move some expensive consistency checking from dns_free_all() into assert_cache_ok(). svn:r9533
Diffstat (limited to 'src/or/dns.c')
-rw-r--r--src/or/dns.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index e95ce32733..26cc1ede62 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -320,20 +320,12 @@ void
dns_free_all(void)
{
cached_resolve_t **ptr, **next, *item;
+ assert_cache_ok();
if (cached_resolve_pqueue) {
SMARTLIST_FOREACH(cached_resolve_pqueue, cached_resolve_t *, res,
{
- /* XXXX012 The hash lookups here could be quite slow; remove them
- * once we're happy. (Leave them in for at least 0.1.2.7-alpha, so they
- * get some testing.) -NM */
- if (res->state == CACHE_STATE_DONE) {
- cached_resolve_t *found = HT_FIND(cache_map, &cache_root, res);
- tor_assert(!found || found != res);
+ if (res->state == CACHE_STATE_DONE)
_free_cached_resolve(res);
- } else {
- cached_resolve_t *found = HT_FIND(cache_map, &cache_root, res);
- tor_assert(found);
- }
});
}
for (ptr = HT_START(cache_map, &cache_root); ptr != NULL; ptr = next) {
@@ -2032,6 +2024,17 @@ _assert_cache_ok(void)
smartlist_pqueue_assert_ok(cached_resolve_pqueue,
_compare_cached_resolves_by_expiry);
+
+ SMARTLIST_FOREACH(cached_resolve_pqueue, cached_resolve_t *, res,
+ {
+ if (res->state == CACHE_STATE_DONE) {
+ cached_resolve_t *found = HT_FIND(cache_map, &cache_root, res);
+ tor_assert(!found || found != res);
+ } else {
+ cached_resolve_t *found = HT_FIND(cache_map, &cache_root, res);
+ tor_assert(found);
+ }
+ });
}
#endif