diff options
author | Roger Dingledine <arma@torproject.org> | 2006-06-13 05:47:12 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2006-06-13 05:47:12 +0000 |
commit | 1ae2e73a9c80d220f52d16d0c983e305855a492a (patch) | |
tree | 80d8aeb936a7cba32938b0edff9521cc868afe27 /src | |
parent | 5c9779f47b4197f658abd131f7fda6b09f4526a0 (diff) | |
download | tor-1ae2e73a9c80d220f52d16d0c983e305855a492a.tar.gz tor-1ae2e73a9c80d220f52d16d0c983e305855a492a.zip |
backport the reachability bugfix.
svn:r6611
Diffstat (limited to 'src')
-rw-r--r-- | src/or/connection_or.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 8e1105491d..6d1a151d3c 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -312,12 +312,15 @@ connection_or_finished_connecting(connection_t *conn) * if the other side initiated it. */ static void -connection_or_init_conn_from_router(connection_t *conn, routerinfo_t *router) +connection_or_init_conn_from_router(connection_t *conn, routerinfo_t *router, + int started_here) { or_options_t *options = get_options(); - conn->addr = router->addr; - conn->port = router->or_port; + if (!started_here) { + conn->addr = router->addr; + conn->port = router->or_port; + } conn->receiver_bucket = conn->bandwidth = (int)options->BandwidthBurst; conn->identity_pkey = crypto_pk_dup_key(router->identity_pkey); connection_or_set_identity_digest(conn, router->cache_info.identity_digest); @@ -332,17 +335,18 @@ connection_or_init_conn_from_router(connection_t *conn, routerinfo_t *router) static void connection_or_init_conn_from_address(connection_t *conn, uint32_t addr, uint16_t port, - const char *id_digest) + const char *id_digest, + int started_here) { const char *n; or_options_t *options = get_options(); routerinfo_t *r = router_get_by_digest(id_digest); + conn->addr = addr; + conn->port = port; if (r) { - connection_or_init_conn_from_router(conn,r); + connection_or_init_conn_from_router(conn, r, started_here); return; } - conn->addr = addr; - conn->port = port; /* This next part isn't really right, but it's good enough for now. */ conn->receiver_bucket = conn->bandwidth = (int)options->BandwidthBurst; connection_or_set_identity_digest(conn, id_digest); @@ -446,7 +450,7 @@ connection_or_connect(uint32_t addr, uint16_t port, const char *id_digest) conn = connection_new(CONN_TYPE_OR); /* set up conn so it's got all the data we need to remember */ - connection_or_init_conn_from_address(conn, addr, port, id_digest); + connection_or_init_conn_from_address(conn, addr, port, id_digest, 1); conn->state = OR_CONN_STATE_CONNECTING; control_event_or_conn_status(conn, OR_CONN_EVENT_LAUNCHED); @@ -690,7 +694,7 @@ connection_tls_finish_handshake(connection_t *conn) } #endif connection_or_init_conn_from_address(conn,conn->addr,conn->port, - digest_rcvd); + digest_rcvd, 0); /* Annotate that we received a TLS connection. * (Todo: only actually consider ourselves reachable if there * exists a testing circuit using conn.) |