r13401@catbus: nickm | 2007-06-13 15:50:16 -0400

Add dnsport connection to the global connection list. (Bug found by mwenge.)


svn:r10592
This commit is contained in:
Nick Mathewson 2007-06-13 19:50:18 +00:00
parent eab7c6890d
commit 4b162fd1f4
3 changed files with 17 additions and 7 deletions

View File

@ -25,6 +25,9 @@ Changes in version 0.2.0.3-alpha - 2007-??-??
o Minor bugfixes (dns):
- Fix a crash when DNSPort is set more than once. (Patch from Robert
Hogan.) [Bugfix on 0.2.0.2-alpha]
- Add DNSPort connections to the global connection list, so that we
can time them out correctly. (Bug found by mwenge) [Bugfix on
0.2.0.2-alpha]
o Minor bugfixes (hidden services):
- Stop tearing down the whole circuit when the user asks for a

View File

@ -122,6 +122,8 @@ evdns_server_callback(struct evdns_server_request *req, void *_data)
conn->dns_server_request = req;
connection_add(TO_CONN(conn));
/* Now, throw the connection over to get rewritten (which will answer it
* immediately if it's in the cache, or completely bogus, or automapped),
* and then attached to a circuit. */

View File

@ -162,18 +162,23 @@ int
connection_add(connection_t *conn)
{
tor_assert(conn);
tor_assert(conn->s >= 0 || conn->linked);
tor_assert(conn->s >= 0 ||
conn->linked ||
(conn->type == CONN_TYPE_AP &&
TO_EDGE_CONN(conn)->dns_server_request));
tor_assert(conn->conn_array_index == -1); /* can only connection_add once */
conn->conn_array_index = smartlist_len(connection_array);
smartlist_add(connection_array, conn);
if (conn->s >= 0) {
conn->read_event = tor_malloc_zero(sizeof(struct event));
conn->write_event = tor_malloc_zero(sizeof(struct event));
event_set(conn->read_event, conn->s, EV_READ|EV_PERSIST,
conn_read_callback, conn);
event_set(conn->write_event, conn->s, EV_WRITE|EV_PERSIST,
conn_write_callback, conn);
}
log_debug(LD_NET,"new conn type %s, socket %d, n_conns %d.",
conn_type_to_string(conn->type), conn->s,