diff options
author | Roger Dingledine <arma@torproject.org> | 2004-08-18 10:32:50 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-08-18 10:32:50 +0000 |
commit | 3937ecfaae5aa9613e48a3f383acfe15d705ab7c (patch) | |
tree | 25ce79bcbdc6ae8637e699e6ae803d2169f81648 | |
parent | 20b88190238a9fe4ba3399e45f1f3e068fdba2e4 (diff) | |
download | tor-3937ecfaae5aa9613e48a3f383acfe15d705ab7c.tar.gz tor-3937ecfaae5aa9613e48a3f383acfe15d705ab7c.zip |
when we try to exclude our routerinfo from being picked in the
path, it fails because we're using a pointer to the routerinfo we
generate, not a pointer to the routerinfo in the routerlist. so look
up the right one and use that.
svn:r2286
-rw-r--r-- | src/or/circuitbuild.c | 4 | ||||
-rw-r--r-- | src/or/or.h | 1 | ||||
-rw-r--r-- | src/or/routerlist.c | 16 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index acc2deb375..9a45492589 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1098,7 +1098,7 @@ static routerinfo_t *choose_good_middle_server(cpath_build_state_t *state, excluded = smartlist_create(); if((r = router_get_by_digest(state->chosen_exit_digest))) smartlist_add(excluded, r); - if((r = router_get_my_routerinfo())) + if((r = routerlist_find_my_routerinfo())) smartlist_add(excluded, r); for (i = 0, cpath = head; i < cur_len; ++i, cpath=cpath->next) { r = router_get_by_digest(cpath->identity_digest); @@ -1119,7 +1119,7 @@ static routerinfo_t *choose_good_entry_server(cpath_build_state_t *state) if((r = router_get_by_digest(state->chosen_exit_digest))) smartlist_add(excluded, r); - if((r = router_get_my_routerinfo())) + if((r = routerlist_find_my_routerinfo())) smartlist_add(excluded, r); if(options.FascistFirewall) { /* exclude all ORs that listen on the wrong port */ diff --git a/src/or/or.h b/src/or/or.h index 38f4899185..36fd64fbe0 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1395,6 +1395,7 @@ routerinfo_t *router_pick_directory_server(int requireauth, int requireothers); int all_directory_servers_down(void); struct smartlist_t; void add_nickname_list_to_smartlist(struct smartlist_t *sl, const char *list); +routerinfo_t *routerlist_find_my_routerinfo(void); int router_nickname_matches(routerinfo_t *router, const char *nickname); routerinfo_t *routerlist_sl_choose_by_bandwidth(smartlist_t *sl); routerinfo_t *router_choose_random_node(char *preferred, char *excluded, diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 3995fd7d98..d24286a0b0 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -207,6 +207,22 @@ router_add_running_routers_to_smartlist(smartlist_t *sl, int allow_unverified) } } +routerinfo_t * +routerlist_find_my_routerinfo(void) { + routerinfo_t *router; + int i; + + if(!routerlist) + return NULL; + + for(i=0;i<smartlist_len(routerlist->routers);i++) { + router = smartlist_get(routerlist->routers, i); + if(router_is_me(router)) + return router; + } + return NULL; +} + /** How many seconds a router must be up before we'll use it for * reliability-critical node positions. */ |