diff options
-rw-r--r-- | src/or/circuitbuild.c | 17 | ||||
-rw-r--r-- | src/or/config.c | 3 | ||||
-rw-r--r-- | src/or/or.h | 1 | ||||
-rw-r--r-- | src/or/routerlist.c | 7 |
4 files changed, 23 insertions, 5 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 12b2afe90..7acb876bc 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1074,14 +1074,19 @@ static routerinfo_t *choose_good_middle_server(cpath_build_state_t *state, log_fn(LOG_DEBUG, "Contemplating intermediate hop: random choice."); excluded = smartlist_create(); - if((r = router_get_by_digest(state->chosen_exit_digest))) + if((r = router_get_by_digest(state->chosen_exit_digest))) { smartlist_add(excluded, r); - if((r = routerlist_find_my_routerinfo())) + routerlist_add_friends(excluded, r); + } + if((r = routerlist_find_my_routerinfo())) { smartlist_add(excluded, r); + routerlist_add_friends(excluded, r); + } for (i = 0, cpath = head; i < cur_len; ++i, cpath=cpath->next) { r = router_get_by_digest(cpath->identity_digest); tor_assert(r); smartlist_add(excluded, r); + routerlist_add_friends(excluded, r); } choice = router_choose_random_node("", options.ExcludeNodes, excluded, 0, 1, options._AllowUnverified & ALLOW_UNVERIFIED_MIDDLE, 0); @@ -1095,10 +1100,14 @@ static routerinfo_t *choose_good_entry_server(cpath_build_state_t *state) smartlist_t *excluded = smartlist_create(); char buf[16]; - if((r = router_get_by_digest(state->chosen_exit_digest))) + if((r = router_get_by_digest(state->chosen_exit_digest))) { smartlist_add(excluded, r); - if((r = routerlist_find_my_routerinfo())) + routerlist_add_friends(excluded, r); + } + if((r = routerlist_find_my_routerinfo())) { smartlist_add(excluded, r); + routerlist_add_friends(excluded, r); + } if(options.FascistFirewall) { /* exclude all ORs that listen on the wrong port */ routerlist_t *rl; diff --git a/src/or/config.c b/src/or/config.c index 6f78b0b66..7e060efa1 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1045,7 +1045,8 @@ const char *get_data_directory(or_options_t *options) { if (d && strncmp(d,"~/",2)==0) { char *fn = expand_filename(d); if(!fn) { - /* XXX complain and exit(1) here */ + log_fn(LOG_ERR,"Failed to expand filename '%s'. Exiting.",d); + exit(1); } tor_free(options->DataDirectory); options->DataDirectory = fn; diff --git a/src/or/or.h b/src/or/or.h index c04403aac..04f02aba2 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1394,6 +1394,7 @@ int router_reload_router_list(void); routerinfo_t *router_pick_directory_server(int requireauth, int requireothers); int all_directory_servers_down(void); struct smartlist_t; +void routerlist_add_friends(struct smartlist_t *sl, routerinfo_t *router); void add_nickname_list_to_smartlist(struct smartlist_t *sl, const char *list, int warn_if_down); routerinfo_t *routerlist_find_my_routerinfo(void); int router_nickname_matches(routerinfo_t *router, const char *nickname); diff --git a/src/or/routerlist.c b/src/or/routerlist.c index dfd58283c..86d11c09e 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -175,6 +175,13 @@ int all_directory_servers_down(void) { return 1; } +/** Add all the friends of <b>router</b> to the smartlist <b>sl</b>. + */ +void routerlist_add_friends(smartlist_t *sl, routerinfo_t *router) { + + +} + /** Given a comma-and-whitespace separated list of nicknames, see which * nicknames in <b>list</b> name routers in our routerlist that are * currently running. Add the routerinfos for those routers to <b>sl</b>. |