diff options
author | Roger Dingledine <arma@torproject.org> | 2003-11-20 17:49:45 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2003-11-20 17:49:45 +0000 |
commit | 975bb680106f58bc1fced05a932f452e661e0157 (patch) | |
tree | 878045d9301df8eca9aaa957fd0134d14e963aff /src/or/onion.c | |
parent | 84fffd3652edf6381a487d5b3b08023e39dab763 (diff) | |
download | tor-975bb680106f58bc1fced05a932f452e661e0157.tar.gz tor-975bb680106f58bc1fced05a932f452e661e0157.zip |
simplify: options.OnionRouter==1 iff options.ORPort>0
svn:r857
Diffstat (limited to 'src/or/onion.c')
-rw-r--r-- | src/or/onion.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/or/onion.c b/src/or/onion.c index 5cb8c42d89..ebda1f4f74 100644 --- a/src/or/onion.c +++ b/src/or/onion.c @@ -386,7 +386,7 @@ static int count_acceptable_routers(routerinfo_t **rarray, int rarray_len) { log_fn(LOG_DEBUG,"Nope, the directory says %d is not running.",i); goto next_i_loop; } - if(options.OnionRouter) { + if(options.ORPort) { conn = connection_exact_get_by_addr_port(rarray[i]->addr, rarray[i]->or_port); if(!conn || conn->type != CONN_TYPE_OR || conn->state != OR_CONN_STATE_OPEN) { log_fn(LOG_DEBUG,"Nope, %d is not connected.",i); @@ -457,6 +457,7 @@ int onion_extend_cpath(crypt_path_t **head_ptr, cpath_build_state_t *state, rout return -1; } start: + /* XXX through each of these, don't pick nodes that are down */ if(cur_len == 0) { /* picking entry node */ log_fn(LOG_DEBUG, "Contemplating first hop: random choice."); choice = rarray[crypto_pseudo_rand_int(rarray_len)]; @@ -474,7 +475,7 @@ int onion_extend_cpath(crypt_path_t **head_ptr, cpath_build_state_t *state, rout !strcasecmp(choice->nickname, state->chosen_exit)) { goto again; } - + for (i = 0, cpath = *head_ptr; i < cur_len; ++i, cpath=cpath->next) { r = router_get_by_addr_port(cpath->addr, cpath->port); if ((r && !crypto_pk_cmp_keys(r->onion_pkey, choice->onion_pkey)) @@ -482,7 +483,7 @@ int onion_extend_cpath(crypt_path_t **head_ptr, cpath_build_state_t *state, rout !strcasecmp(choice->nickname, state->chosen_exit)) || (cpath->addr == choice->addr && cpath->port == choice->or_port) - || (options.OnionRouter && + || (options.ORPort && !(connection_twin_get_by_addr_port(choice->addr, choice->or_port)))) { goto again; |