diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-07-31 18:01:45 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-07-31 18:01:45 +0000 |
commit | 58c0ac77bee0de75db3df231de1974c40b48ea87 (patch) | |
tree | db7fcb0614585a4e3aa5d6d004f9eca1ab31ef63 /src/or/dns.c | |
parent | ea0f5ec8adab0c268895d416c94b3f648c81ef31 (diff) | |
download | tor-58c0ac77bee0de75db3df231de1974c40b48ea87.tar tor-58c0ac77bee0de75db3df231de1974c40b48ea87.tar.gz |
r6981@Kushana: nickm | 2006-07-31 13:23:26 -0400
More asserts for cache correctness.
svn:r6960
Diffstat (limited to 'src/or/dns.c')
-rw-r--r-- | src/or/dns.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/dns.c b/src/or/dns.c index dacbaf6c3..8940e5456 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -226,6 +226,8 @@ static void set_expiry(cached_resolve_t *resolve, time_t expires) { tor_assert(resolve && resolve->expire == 0); + if (!cached_resolve_pqueue) + cached_resolve_pqueue = smartlist_create(); resolve->expire = expires; smartlist_pqueue_add(cached_resolve_pqueue, _compare_cached_resolves_by_expiry, @@ -1241,9 +1243,15 @@ assert_resolve_ok(cached_resolve_t *resolve) tor_assert(resolve); tor_assert(resolve->magic == CACHED_RESOLVE_MAGIC); tor_assert(strlen(resolve->address) < MAX_ADDRESSLEN); + tor_assert(tor_strisnonupper(resolve->address)); if (resolve->state != CACHE_STATE_PENDING) { tor_assert(!resolve->pending_connections); } + if (resolve->state == CACHE_STATE_PENDING || + resolve->state == CACHE_STATE_DONE) { + tor_assert(!resolve->ttl); + tor_assert(!resolve->addr); + } } static void @@ -1260,5 +1268,10 @@ assert_cache_ok(void) assert_resolve_ok(*resolve); tor_assert((*resolve)->state != CACHE_STATE_DONE); } + if (!cached_resolve_pqueue) + return; + + smartlist_pqueue_assert_ok(cached_resolve_pqueue, + _compare_cached_resolves_by_expiry); } |