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);
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 */
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,
}
}
+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.
*/