summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-03-28 21:16:52 +0000
committerRoger Dingledine <arma@torproject.org>2004-03-28 21:16:52 +0000
commit4a5586b8e311114b28defc3bdf7d1d74618e749e (patch)
treef42d200be0e7d8fda7a31b0139b8accd5cadec03
parent2ba9901cb4fcde3a999dd1e8316b39f60cc0ef0e (diff)
downloadtor-4a5586b8e311114b28defc3bdf7d1d74618e749e.tar.gz
tor-4a5586b8e311114b28defc3bdf7d1d74618e749e.zip
make dns resolves a lot faster
(but only enable this once we've found the bug) svn:r1358
-rw-r--r--src/or/dns.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index ebe52e2dbf..c07cba8e24 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -109,11 +109,21 @@ int dns_resolve(connection_t *exitconn) {
struct cached_resolve *resolve;
struct cached_resolve search;
struct pending_connection_t *pending_connection;
+ struct in_addr in;
uint32_t now = time(NULL);
assert_connection_ok(exitconn, 0);
- /* first take this opportunity to see if there are any expired
- resolves in the tree.*/
+#if 0 /* only enable this once we've found the conn-munging bug */
+ /* first check if exitconn->address is an IP. If so, we already
+ * know the answer. */
+ if (tor_inet_aton(exitconn->address, &in) != 0) {
+ exitconn->addr = ntohl(in.s_addr);
+ return 1;
+ }
+#endif
+
+ /* then take this opportunity to see if there are any expired
+ * resolves in the tree. */
purge_expired_resolves(now);
/* now check the tree to see if 'address' is already there. */