diff options
author | Roger Dingledine <arma@torproject.org> | 2005-04-06 20:25:21 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-04-06 20:25:21 +0000 |
commit | 03720b39fdb347296c02d9f42618910c83d83f4f (patch) | |
tree | 74b16a6266da0eca717af7522281dd459112a9e3 /src/or | |
parent | 46089c49c43d539a92e336f763d12ee7c36661ff (diff) | |
download | tor-03720b39fdb347296c02d9f42618910c83d83f4f.tar.gz tor-03720b39fdb347296c02d9f42618910c83d83f4f.zip |
stop wasting time doing a case insensitive comparison for every dns name
every time we do any lookup. canonicalize the names to lowercase and be
done with it.
svn:r4035
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/dns.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/dns.c b/src/or/dns.c index de30fe09e0..5ae666effc 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -81,7 +81,7 @@ static SPLAY_HEAD(cache_tree, cached_resolve) cache_root; static int compare_cached_resolves(struct cached_resolve *a, struct cached_resolve *b) { /* make this smarter one day? */ - return strncasecmp(a->address, b->address, MAX_ADDRESSLEN); + return strncmp(a->address, b->address, MAX_ADDRESSLEN); } SPLAY_PROTOTYPE(cache_tree, cached_resolve, node, compare_cached_resolves); @@ -246,6 +246,9 @@ int dns_resolve(connection_t *exitconn) { * resolves in the tree. */ purge_expired_resolves(now); + /* lower-case exitconn->address, so it's in canonical form */ + tor_strlower(exitconn->address); + /* now check the tree to see if 'address' is already there. */ strlcpy(search.address, exitconn->address, sizeof(search.address)); resolve = SPLAY_FIND(cache_tree, &cache_root, &search); |