aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_edge.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-09-21 18:12:12 +0000
committerNick Mathewson <nickm@torproject.org>2004-09-21 18:12:12 +0000
commit9defe8a307e55163beb904457c9536a527b518f8 (patch)
tree4496cdcee0f2a25ca62c37a3cde1aa331921c28f /src/or/connection_edge.c
parentc20b24c952e4018ac738c633c2fc821bbc80958d (diff)
downloadtor-9defe8a307e55163beb904457c9536a527b518f8.tar
tor-9defe8a307e55163beb904457c9536a527b518f8.tar.gz
Attach dummy resolve connections to a circuit *before* calling dns_resolve(). This fixes a bug where cached answers would never be sent in RESOLVED cells.
svn:r2360
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r--src/or/connection_edge.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index e6b02257f..d1bf109f2 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -855,19 +855,17 @@ int connection_exit_begin_resolve(cell_t *cell, circuit_t *circ) {
dummy_conn->state = EXIT_CONN_STATE_RESOLVEFAILED;
dummy_conn->purpose = EXIT_PURPOSE_RESOLVE;
+ dummy_conn->next_stream = circ->resolving_streams;
+ circ->resolving_streams = dummy_conn;
+
/* send it off to the gethostbyname farm */
switch(dns_resolve(dummy_conn)) {
- case 1: /* resolve worked; resolved cell was sent. */
+ case 1: /* The result was cached; a resolved cell was sent. */
+ case -1:
+ circuit_detach_stream(circuit_get_by_conn(dummy_conn), dummy_conn);
connection_free(dummy_conn);
return 0;
- case -1: /* resolve failed; resolved cell was sent. */
- log_fn(LOG_INFO,"Resolve failed (%s).",dummy_conn->address);
- connection_free(dummy_conn);
- break;
case 0: /* resolve added to pending list */
- /* add it into the linked list of resolving_streams on this circuit */
- dummy_conn->next_stream = circ->resolving_streams;
- circ->resolving_streams = dummy_conn;
assert_circuit_ok(circ);
;
}