aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-07-27 17:16:10 +0000
committerNick Mathewson <nickm@torproject.org>2006-07-27 17:16:10 +0000
commitdc2b7e9af08aeb7c45bc45ad9ddc1fd2f8ebb6e8 (patch)
tree7dd89a1696a14134636b080741f2131dfc94aa68
parent5227395aba9928a5505117f632e1ea7271944d8a (diff)
downloadtor-dc2b7e9af08aeb7c45bc45ad9ddc1fd2f8ebb6e8.tar
tor-dc2b7e9af08aeb7c45bc45ad9ddc1fd2f8ebb6e8.tar.gz
Add more asserts in dns_found_answer. This may confirm my theory that dns_purge_resolve is the culprit.
svn:r6922
-rw-r--r--src/or/dns.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index 04c946b7c..0ec2a6c6e 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -633,9 +633,11 @@ dns_found_answer(const char *address, uint32_t addr, char outcome,
resolve->addr = addr;
resolve->expire = time(NULL) + dns_get_expiry_ttl(ttl);
resolve->ttl = ttl;
+ assert_resolve_ok(resolve);
insert_resolve(resolve);
return;
}
+ assert_resolve_ok(resolve);
if (resolve->state != CACHE_STATE_PENDING) {
/* XXXX Maybe update addr? or check addr for consistency? Or let
@@ -661,11 +663,11 @@ dns_found_answer(const char *address, uint32_t addr, char outcome,
while (resolve->pending_connections) {
pend = resolve->pending_connections;
- assert_connection_ok(TO_CONN(pend->conn),time(NULL));
- pend->conn->_base.addr = resolve->addr;
- pend->conn->address_ttl = resolve->ttl;
pendconn = pend->conn; /* don't pass complex things to the
connection_mark_for_close macro */
+ assert_connection_ok(TO_CONN(pendconn),time(NULL));
+ pendconn->_base.addr = resolve->addr;
+ pendconn->address_ttl = resolve->ttl;
if (resolve->state == CACHE_STATE_FAILED) {
/* prevent double-remove. */
@@ -711,6 +713,8 @@ dns_found_answer(const char *address, uint32_t addr, char outcome,
resolve->pending_connections = pend->next;
tor_free(pend);
}
+ assert_resolve_ok(resolve);
+ assert_cache_ok();
if (outcome == DNS_RESOLVE_FAILED_TRANSIENT) { /* remove from cache */
dns_purge_resolve(resolve);