summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-02-28 22:06:59 +0000
committerNick Mathewson <nickm@torproject.org>2004-02-28 22:06:59 +0000
commit833d14246d3f512f6a0411c9cc6b455e05fbb35b (patch)
tree06e8efc00e88a571ef69da7ee549e43a131690bd
parent55174d1cb0927dde9864369f419d0d2d31cccfcc (diff)
downloadtor-833d14246d3f512f6a0411c9cc6b455e05fbb35b.tar.gz
tor-833d14246d3f512f6a0411c9cc6b455e05fbb35b.zip
Make dns_cancel_pending_resolve less agressive.
svn:r1166
-rw-r--r--src/or/dns.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index 57e95ba7ec..c05fcbd32a 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -185,9 +185,10 @@ static int assign_to_dnsworker(connection_t *exitconn) {
return 0;
}
-/* if onlyconn is NULL, cancel the whole thing. if onlyconn is defined,
- * then remove onlyconn from the pending list, and if the pending list
- * is now empty, cancel the whole thing.
+
+/* If onlyconn is NULL, cancel all pending connections. If onlyconn is
+ * defined, then remove onlyconn from the pending list. Does not cancel the
+ * resolve itself, or remove the 'struct cached_resolve' from the cache.
*/
void dns_cancel_pending_resolve(char *address, connection_t *onlyconn) {
struct pending_connection_t *pend, *victim;
@@ -214,7 +215,6 @@ void dns_cancel_pending_resolve(char *address, connection_t *onlyconn) {
if(resolve->pending_connections) {/* more pending, don't cancel it */
log_fn(LOG_DEBUG, "Connection (fd %d) no longer waiting for resolve of '%s'",
onlyconn->s, address);
- return;
}
} else {
for( ; pend->next; pend = pend->next) {
@@ -240,26 +240,6 @@ void dns_cancel_pending_resolve(char *address, connection_t *onlyconn) {
free(pend);
}
}
-
- /* remove resolve from the linked list */
- if(resolve == oldest_cached_resolve) {
- oldest_cached_resolve = resolve->next;
- if(oldest_cached_resolve == NULL)
- newest_cached_resolve = NULL;
- } else {
- /* FFFF make it a doubly linked list if this becomes too slow */
- for(tmp=oldest_cached_resolve; tmp && tmp->next != resolve; tmp=tmp->next) ;
- assert(tmp); /* it's got to be in the list, or we screwed up somewhere else */
- tmp->next = resolve->next; /* unlink it */
-
- if(newest_cached_resolve == resolve)
- newest_cached_resolve = tmp;
- }
-
- /* remove resolve from the tree */
- SPLAY_REMOVE(cache_tree, &cache_root, resolve);
-
- free(resolve);
}
static void dns_found_answer(char *address, uint32_t addr) {