summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-01-08 11:00:21 -0500
committerNick Mathewson <nickm@torproject.org>2015-01-08 11:00:21 -0500
commit905287415b834db1a92205e8436f66a3b2d6846c (patch)
treec59d5e1ade831de8a1782fb1698fd06cb408a490 /src
parentdca902ceba4d2440520d357ccc2e00b8aa59eb8b (diff)
downloadtor-905287415b834db1a92205e8436f66a3b2d6846c.tar.gz
tor-905287415b834db1a92205e8436f66a3b2d6846c.zip
Avoid attempts to double-remove edge connections from the DNS resolver.
Also, avoid crashing when we attempt to double-remove an edge connection from the DNS resolver: just log a bug warning instead. Fixes bug 14129. Bugfix on 0d20fee2fbd48978, which was in 0.0.7rc1. jowr found the bug. cypherpunks wrote the fix. I added the log message and removed the assert.
Diffstat (limited to 'src')
-rw-r--r--src/or/dns.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/dns.c b/src/or/dns.c
index fb1b10d82c..8b6e3b0543 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -557,6 +557,8 @@ purge_expired_resolves(time_t now)
/* Connections should only be pending if they have no socket. */
tor_assert(!SOCKET_OK(pend->conn->base_.s));
pendconn = pend->conn;
+ /* Prevent double-remove */
+ pendconn->base_.state = EXIT_CONN_STATE_RESOLVEFAILED;
if (!pendconn->base_.marked_for_close) {
connection_edge_end(pendconn, END_STREAM_REASON_TIMEOUT);
circuit_detach_stream(circuit_get_by_edge_conn(pendconn), pendconn);
@@ -1132,7 +1134,9 @@ connection_dns_remove(edge_connection_t *conn)
return; /* more are pending */
}
}
- tor_assert(0); /* not reachable unless onlyconn not in pending list */
+ log_warn(LD_BUG, "Connection (fd "TOR_SOCKET_T_FORMAT") was not waiting "
+ "for a resolve of %s, but we tried to remove it.",
+ conn->base_.s, escaped_safe_str(conn->base_.address));
}
}