[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r6960: More asserts for cache correctness. (in tor/trunk: . src/or)
Author: nickm
Date: 2006-07-31 14:01:45 -0400 (Mon, 31 Jul 2006)
New Revision: 6960
Modified:
tor/trunk/
tor/trunk/src/or/dns.c
Log:
r6981@Kushana: nickm | 2006-07-31 13:23:26 -0400
More asserts for cache correctness.
Property changes on: tor/trunk
___________________________________________________________________
Name: svk:merge
- c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/eventdns:6980
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/oo-connections:6950
+ c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/eventdns:6981
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/oo-connections:6950
Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c 2006-07-31 18:01:37 UTC (rev 6959)
+++ tor/trunk/src/or/dns.c 2006-07-31 18:01:45 UTC (rev 6960)
@@ -226,6 +226,8 @@
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 @@
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_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);
}