diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-02-28 21:52:58 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-02-28 21:52:58 +0000 |
commit | 55174d1cb0927dde9864369f419d0d2d31cccfcc (patch) | |
tree | 75e704f2997a12c41d6c78dd6708c7499625a623 | |
parent | fadfd2618808252def4b06345c91288f2ade1a1f (diff) | |
download | tor-55174d1cb0927dde9864369f419d0d2d31cccfcc.tar.gz tor-55174d1cb0927dde9864369f419d0d2d31cccfcc.zip |
Fix bug on dns_found_answer from mark_to_close stuff.
svn:r1165
-rw-r--r-- | src/or/dns.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/or/dns.c b/src/or/dns.c index 843992bcad..57e95ba7ec 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -297,16 +297,19 @@ static void dns_found_answer(char *address, uint32_t addr) { while(resolve->pending_connections) { pend = resolve->pending_connections; - assert_connection_ok(pend->conn,0); + assert_connection_ok(pend->conn,time(NULL)); pend->conn->addr = resolve->addr; if(resolve->state == CACHE_STATE_FAILED) { + /* This calls dns_cancel_pending_resolve, which removes pend + * from the list, so we don't have to do it. Beware of + * modify-while-iterating bugs hereabouts! */ connection_mark_for_close(pend->conn, END_STREAM_REASON_RESOLVEFAILED); + assert(resolve->pending_connections != pend); } else { - assert_connection_ok(pend->conn, time(NULL)); connection_exit_connect(pend->conn); + resolve->pending_connections = pend->next; + free(pend); } - resolve->pending_connections = pend->next; - free(pend); } } |