aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-07-01 23:13:04 +0000
committerNick Mathewson <nickm@torproject.org>2004-07-01 23:13:04 +0000
commitcbab134bd98984a7758ac8cd80daa4a9bf16a406 (patch)
tree6686c57309858b5c46d32f4e485fbc8e96e66d05
parente1ba0c466341a883394d446c0ad81855c1076b9d (diff)
downloadtor-cbab134bd98984a7758ac8cd80daa4a9bf16a406.tar
tor-cbab134bd98984a7758ac8cd80daa4a9bf16a406.tar.gz
Switch most uses of *_by_addr_port to *_by_identity_digest
svn:r1997
-rw-r--r--src/or/circuitbuild.c12
-rw-r--r--src/or/connection_or.c5
-rw-r--r--src/or/cpuworker.c2
-rw-r--r--src/or/router.c3
-rw-r--r--src/or/routerlist.c3
5 files changed, 16 insertions, 9 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 1cce48a23..ac1629a3a 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -77,7 +77,7 @@ void circuit_log_path(int severity, circuit_t *circ) {
hop=circ->cpath;
do {
s = buf + strlen(buf);
- router = router_get_by_addr_port(hop->addr,hop->port);
+ router = router_get_by_digest(hop->identity_digest);
if(router) {
snprintf(s, sizeof(buf) - (s - buf), "%s(%s) ",
router->nickname, states[hop->state]);
@@ -115,7 +115,7 @@ void circuit_rep_hist_note_result(circuit_t *circ) {
prev_nickname = options.Nickname;
}
do {
- router = router_get_by_addr_port(hop->addr,hop->port);
+ router = router_get_by_digest(hop->identity_digest);
if (router) {
if (prev_nickname) {
if (hop->state == CPATH_STATE_OPEN)
@@ -218,7 +218,8 @@ circuit_t *circuit_establish_circuit(uint8_t purpose,
log_fn(LOG_DEBUG,"Looking for firsthop '%s:%u'",
firsthop->address,firsthop->or_port);
- n_conn = connection_twin_get_by_addr_port(firsthop->addr,firsthop->or_port);
+ n_conn = connection_get_by_identity_digest(firsthop->identity_digest,
+ CONN_TYPE_OR);
if(!n_conn || n_conn->state != OR_CONN_STATE_OPEN) { /* not currently connected */
circ->n_addr = firsthop->addr;
circ->n_port = firsthop->or_port;
@@ -954,7 +955,8 @@ static int count_acceptable_routers(smartlist_t *routers) {
goto next_i_loop;
}
if(options.ORPort) {
- conn = connection_exact_get_by_addr_port(r->addr, r->or_port);
+ conn = connection_get_by_identity_digest(r->identity_digest,
+ CONN_TYPE_OR);
if(!conn || conn->type != CONN_TYPE_OR || conn->state != OR_CONN_STATE_OPEN) {
log_fn(LOG_DEBUG,"Nope, %d is not connected.",i);
goto next_i_loop;
@@ -1090,7 +1092,7 @@ onion_extend_cpath(crypt_path_t **head_ptr, cpath_build_state_t
remove_twins_from_smartlist(sl,router_get_by_nickname(state->chosen_exit));
remove_twins_from_smartlist(sl,router_get_my_routerinfo());
for (i = 0, cpath = *head_ptr; i < cur_len; ++i, cpath=cpath->next) {
- r = router_get_by_addr_port(cpath->addr, cpath->port);
+ r = router_get_by_digest(cpath->identity_digest);
tor_assert(r);
remove_twins_from_smartlist(sl,r);
}
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index abd8476f7..ea428b6f5 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -160,7 +160,8 @@ connection_t *connection_or_connect(routerinfo_t *router) {
/* this function should never be called if we're already connected to router, but */
/* check first to be sure */
- conn = connection_exact_get_by_addr_port(router->addr,router->or_port);
+ conn = connection_get_by_identity_digest(router->identity_digest,
+ CONN_TYPE_OR);
if(conn)
return conn;
@@ -304,7 +305,7 @@ connection_tls_finish_handshake(connection_t *conn) {
return -1;
}
} else {
- if((c=connection_exact_get_by_addr_port(router->addr,router->or_port))) {
+ if((c=connection_get_by_identity_digest(router->identity_digest, CONN_TYPE_OR))) {
log_fn(LOG_INFO,"Router %s is already connected on fd %d. Dropping fd %d.", router->nickname, c->s, conn->s);
return -1;
}
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 1b55822a5..c3e567cdf 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -132,6 +132,8 @@ int connection_cpu_process_inbuf(connection_t *conn) {
/* parse out the circ it was talking about */
tag_unpack(buf, &addr, &port, &circ_id);
circ = NULL;
+ /* XXXX This is actually right: we want a specific port here in
+ * case there are multiple connections. */
p_conn = connection_exact_get_by_addr_port(addr,port);
if(p_conn)
circ = circuit_get_by_circ_id_conn(circ_id, p_conn);
diff --git a/src/or/router.c b/src/or/router.c
index cd256e384..e53a27d01 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -317,7 +317,8 @@ void router_retry_connections(void) {
router = smartlist_get(rl->routers, i);
if(router_is_me(router))
continue;
- if(!connection_exact_get_by_addr_port(router->addr,router->or_port)) {
+ if(!connection_get_by_identity_digest(router->identity_digest,
+ CONN_TYPE_OR)) {
/* not in the list */
log_fn(LOG_DEBUG,"connecting to OR %s:%u.",router->address,router->or_port);
connection_or_connect(router);
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 24553bc1b..9416aafd2 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -147,7 +147,8 @@ void router_add_running_routers_to_smartlist(smartlist_t *sl) {
router = smartlist_get(routerlist->routers, i);
if(router->is_running &&
(!options.ORPort ||
- connection_twin_get_by_addr_port(router->addr, router->or_port) ))
+ connection_get_by_identity_digest(router->identity_digest,
+ CONN_TYPE_OR)))
smartlist_add(sl, router);
}
}