summaryrefslogtreecommitdiff
path: root/src/or/dns.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-06-02 18:32:24 +0000
committerRoger Dingledine <arma@torproject.org>2004-06-02 18:32:24 +0000
commit69931106f898aecb60d503d6e10e3aa118961c29 (patch)
tree99ea7ee36a2fc5820e8a764cb8e143a784db7dad /src/or/dns.c
parent0932505829b3c06b1ad4828005601dce3a74586b (diff)
downloadtor-69931106f898aecb60d503d6e10e3aa118961c29.tar.gz
tor-69931106f898aecb60d503d6e10e3aa118961c29.zip
be sure to detach streams from the circuit linked list before freeing them
also, don't bother marking a conn for close if you're about to free it svn:r1935
Diffstat (limited to 'src/or/dns.c')
-rw-r--r--src/or/dns.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index 3809fe7689..a540ade8f2 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -125,7 +125,7 @@ static void purge_expired_resolves(uint32_t now) {
pendconn = pend->conn;
connection_edge_end(pendconn, END_STREAM_REASON_MISC,
pendconn->cpath_layer);
- connection_mark_for_close(pendconn);
+ circuit_detach_stream(circuit_get_by_conn(pendconn), pendconn);
connection_free(pendconn);
tor_free(pend);
}
@@ -360,15 +360,13 @@ void dns_cancel_pending_resolve(char *address) {
address);
while(resolve->pending_connections) {
pend = resolve->pending_connections;
- /* So that mark_for_close doesn't double-remove the connection. */
pend->conn->state = EXIT_CONN_STATE_RESOLVEFAILED;
- pendconn = pend->conn; /* don't pass complex things to the
- connection_mark_for_close macro */
+ pendconn = pend->conn;
tor_assert(pendconn->s == -1);
if(!pendconn->marked_for_close) {
connection_edge_end(pendconn, END_STREAM_REASON_MISC, pendconn->cpath_layer);
- connection_mark_for_close(pendconn);
}
+ circuit_detach_stream(circuit_get_by_conn(pendconn), pendconn);
connection_free(pendconn);
resolve->pending_connections = pend->next;
tor_free(pend);
@@ -460,7 +458,6 @@ static void dns_found_answer(char *address, uint32_t addr, char outcome) {
pendconn->state = EXIT_CONN_STATE_RESOLVEFAILED;
circuit_detach_stream(circuit_get_by_conn(pendconn), pendconn);
connection_edge_end(pendconn, END_STREAM_REASON_MISC, pendconn->cpath_layer);
- connection_mark_for_close(pendconn);
connection_free(pendconn);
} else {
/* prevent double-remove. */