diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-10-18 17:43:54 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-10-18 17:43:54 +0000 |
commit | 3347c1741d299d9ea8143b73bf063d3e4e23a08e (patch) | |
tree | 4eb23ee729c6010dbaf4961c5c96dac361d34d89 /src/or/circuitbuild.c | |
parent | 95514b32a559c85cc5933f411035468b12ade68f (diff) | |
download | tor-3347c1741d299d9ea8143b73bf063d3e4e23a08e.tar.gz tor-3347c1741d299d9ea8143b73bf063d3e4e23a08e.zip |
Refactor routerlist access slightly: always use router_get_by_routerlist(); change its interface; add modifier functions to add/remove elements from the current routerlist (so we can add indices).
svn:r5276
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r-- | src/or/circuitbuild.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index b2a8b07fd5..fc433c9547 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1254,14 +1254,9 @@ static int onion_pick_cpath_exit(circuit_t *circ, extend_info_t *exit) { cpath_build_state_t *state = circ->build_state; - routerlist_t *rl; + routerlist_t *rl = router_get_routerlist(); int r; - router_get_routerlist(&rl); - if (!rl) { - log_fn(LOG_WARN,"router_get_routerlist returned empty list; closing circ."); - return -1; - } r = new_route_len(get_options()->PathlenCoinWeight, circ->purpose, exit, rl->routers); if (r < 1) /* must be at least 1 */ @@ -1439,13 +1434,9 @@ choose_good_entry_server(cpath_build_state_t *state) } if (firewall_is_fascist()) { /* exclude all ORs that listen on the wrong port */ - routerlist_t *rl; + routerlist_t *rl = router_get_routerlist(); int i; - router_get_routerlist(&rl); - if (!rl) - return NULL; - for (i=0; i < smartlist_len(rl->routers); i++) { r = smartlist_get(rl->routers, i); if (!fascist_firewall_allows_address(r->addr,r->or_port)) @@ -1745,9 +1736,7 @@ helper_nodes_set_status_from_directory(void) if (! helper_nodes) return; - router_get_routerlist(&routers); - if (! routers) - return; + routers = router_get_routerlist(); now = time(NULL); |