summaryrefslogtreecommitdiff
path: root/src/or/onion.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-04-01 03:44:49 +0000
committerRoger Dingledine <arma@torproject.org>2004-04-01 03:44:49 +0000
commitcc3c4245cb80cb7bb98be4868f053fb9421176d3 (patch)
tree5893239bebad7b637548ece00a9484214c17087d /src/or/onion.c
parent9feb44d3c45ebeb6bb42ef98adabf68c20695c73 (diff)
downloadtor-cc3c4245cb80cb7bb98be4868f053fb9421176d3.tar.gz
tor-cc3c4245cb80cb7bb98be4868f053fb9421176d3.zip
let the circuit-launcher choose the exit node (if he wants)
svn:r1428
Diffstat (limited to 'src/or/onion.c')
-rw-r--r--src/or/onion.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/or/onion.c b/src/or/onion.c
index 64f2581c22..71e2a31b43 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -347,7 +347,7 @@ static routerinfo_t *choose_good_exit_server(routerlist_t *dir)
return NULL;
}
-cpath_build_state_t *onion_new_cpath_build_state(void) {
+cpath_build_state_t *onion_new_cpath_build_state(const char *exit_nickname) {
routerlist_t *rl;
int r;
cpath_build_state_t *info;
@@ -357,12 +357,19 @@ cpath_build_state_t *onion_new_cpath_build_state(void) {
r = new_route_len(options.PathlenCoinWeight, rl->routers, rl->n_routers);
if (r < 0)
return NULL;
- exit = choose_good_exit_server(rl);
- if(!exit)
- return NULL;
info = tor_malloc(sizeof(cpath_build_state_t));
info->desired_path_len = r;
- info->chosen_exit = tor_strdup(exit->nickname);
+ if(exit_nickname) { /* the circuit-builder pre-requested one */
+ log_fn(LOG_INFO,"Using requested exit node '%s'", exit_nickname);
+ info->chosen_exit = tor_strdup(exit_nickname);
+ } else { /* we have to decide one */
+ exit = choose_good_exit_server(rl);
+ if(!exit) {
+ tor_free(info);
+ return NULL;
+ }
+ info->chosen_exit = tor_strdup(exit->nickname);
+ }
return info;
}