summaryrefslogtreecommitdiff
path: root/src/or/dns.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-09-21 16:42:07 +0000
committerNick Mathewson <nickm@torproject.org>2004-09-21 16:42:07 +0000
commit0dcc8c70488c5da706bf9a739c4e4b118c8c0ad1 (patch)
tree2b881ca83a34800f048eb502c9d9c26c89997f06 /src/or/dns.c
parent93f085c4a25efcac35a3e874798c894cc2fd050e (diff)
downloadtor-0dcc8c70488c5da706bf9a739c4e4b118c8c0ad1.tar.gz
tor-0dcc8c70488c5da706bf9a739c4e4b118c8c0ad1.zip
Bugfix: When a dns request failed, we would detach any "resolving" streams from the circuit before we would send a the resolve_failed cells.
svn:r2355
Diffstat (limited to 'src/or/dns.c')
-rw-r--r--src/or/dns.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index a3244ad0b3..19dd0e1520 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -494,11 +494,16 @@ static void dns_found_answer(char *address, uint32_t addr, char outcome) {
if(resolve->state == CACHE_STATE_FAILED) {
/* prevent double-remove. */
pendconn->state = EXIT_CONN_STATE_RESOLVEFAILED;
- circuit_detach_stream(circuit_get_by_conn(pendconn), pendconn);
- if (pendconn->purpose == EXIT_PURPOSE_CONNECT)
+ if (pendconn->purpose == EXIT_PURPOSE_CONNECT) {
+ /*XXXX can we safely raise the detach here to happen after we
+ * send the end cell? */
+ circuit_detach_stream(circuit_get_by_conn(pendconn), pendconn);
connection_edge_end(pendconn, END_STREAM_REASON_MISC, pendconn->cpath_layer);
- else
+ } else {
send_resolved_cell(pendconn, RESOLVED_TYPE_ERROR);
+ /* This detach must happen after we send the resolved cell. */
+ circuit_detach_stream(circuit_get_by_conn(pendconn), pendconn);
+ }
connection_free(pendconn);
} else {
if (pendconn->purpose == EXIT_PURPOSE_CONNECT) {