summaryrefslogtreecommitdiff
path: root/src/or/dnsserv.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-03-18 15:13:59 -0400
committerNick Mathewson <nickm@torproject.org>2013-03-18 15:13:59 -0400
commit3f837d4826cce0e7917e79d73b81aefc3fefc6bd (patch)
tree180f45b7c1825911a9ee085221874653aa44eeb2 /src/or/dnsserv.c
parent7e9b6a19d4cdc605039f4e0107cbd5f4781fe150 (diff)
downloadtor-3f837d4826cce0e7917e79d73b81aefc3fefc6bd.tar.gz
tor-3f837d4826cce0e7917e79d73b81aefc3fefc6bd.zip
Make stream events for RESOLVE lookups more consistent
Fixes 8203; patch by Desoxy
Diffstat (limited to 'src/or/dnsserv.c')
-rw-r--r--src/or/dnsserv.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c
index 7032b58145..e877b18911 100644
--- a/src/or/dnsserv.c
+++ b/src/or/dnsserv.c
@@ -147,7 +147,7 @@ evdns_server_callback(struct evdns_server_request *req, void *data_)
return;
}
- control_event_stream_status(entry_conn, STREAM_EVENT_NEW, 0);
+ control_event_stream_status(entry_conn, STREAM_EVENT_NEW_RESOLVE, 0);
/* Now, unless a controller asked us to leave streams unattached,
* throw the connection over to get rewritten (which will
@@ -170,7 +170,7 @@ evdns_server_callback(struct evdns_server_request *req, void *data_)
* response; -1 if we couldn't launch the request.
*/
int
-dnsserv_launch_request(const char *name, int reverse)
+dnsserv_launch_request(const char *name, int reverse, control_connection_t *control_conn)
{
entry_connection_t *entry_conn;
edge_connection_t *conn;
@@ -181,6 +181,10 @@ dnsserv_launch_request(const char *name, int reverse)
conn = ENTRY_TO_EDGE_CONN(entry_conn);
conn->base_.state = AP_CONN_STATE_RESOLVE_WAIT;
+ tor_addr_copy(&TO_CONN(conn)->addr, &control_conn->base_.addr);
+ TO_CONN(conn)->port = control_conn->base_.port;
+ TO_CONN(conn)->address = tor_dup_addr(&control_conn->base_.addr);
+
if (reverse)
entry_conn->socks_request->command = SOCKS_COMMAND_RESOLVE_PTR;
else
@@ -203,6 +207,8 @@ dnsserv_launch_request(const char *name, int reverse)
return -1;
}
+ control_event_stream_status(entry_conn, STREAM_EVENT_NEW_RESOLVE, 0);
+
/* Now, unless a controller asked us to leave streams unattached,
* throw the connection over to get rewritten (which will
* answer it immediately if it's in the cache, or completely bogus, or