diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-07-27 18:35:56 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-07-27 18:35:56 +0000 |
commit | c2f28615ed71396fa14cabe269f337b9697a0a02 (patch) | |
tree | 0e74d5b41bfc8721a5be6debadfb4c851c55a392 /src/or | |
parent | 8786b4b88e6e15333724b1a0374f6388b674ce16 (diff) | |
download | tor-c2f28615ed71396fa14cabe269f337b9697a0a02.tar tor-c2f28615ed71396fa14cabe269f337b9697a0a02.tar.gz |
More asserts in dns.c
svn:r6926
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/dns.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/dns.c b/src/or/dns.c index 3d76ff762..32df394a8 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -224,10 +224,11 @@ static cached_resolve_t *newest_cached_resolve = NULL; static void purge_expired_resolves(uint32_t now) { - cached_resolve_t *resolve; + cached_resolve_t *resolve, *removed; pending_connection_t *pend; edge_connection_t *pendconn; + assert_cache_ok(); /* this is fast because the linked list * oldest_cached_resolve is ordered by when they came in. */ @@ -264,10 +265,12 @@ purge_expired_resolves(uint32_t now) if (!oldest_cached_resolve) /* if there are no more, */ newest_cached_resolve = NULL; /* then make sure the list's tail knows * that too */ - HT_REMOVE(cache_map, &cache_root, resolve); + removed = HT_REMOVE(cache_map, &cache_root, resolve); + tor_assert(removed == resolve); resolve->magic = 0xF0BBF0BB; tor_free(resolve); } + assert_cache_ok(); } /** Send a response to the RESOVLE request of a connection. answer_type must @@ -595,7 +598,8 @@ dns_purge_resolve(cached_resolve_t *resolve) } /* remove resolve from the map */ - HT_REMOVE(cache_map, &cache_root, resolve); + tmp = HT_REMOVE(cache_map, &cache_root, resolve); + tor_assert(tmp == resolve); resolve->magic = 0xAAAAAAAA; tor_free(resolve); } |