choose exit nodes by bandwidth too

svn:r2274
This commit is contained in:
Roger Dingledine 2004-08-18 06:10:12 +00:00
parent 6de61bd694
commit b294a037a4
3 changed files with 4 additions and 3 deletions

View File

@ -909,7 +909,7 @@ static routerinfo_t *choose_good_exit_server_general(routerlist_t *dir)
smartlist_subtract(sl,excludedexits); smartlist_subtract(sl,excludedexits);
if (options.StrictExitNodes || smartlist_overlap(sl,preferredexits)) if (options.StrictExitNodes || smartlist_overlap(sl,preferredexits))
smartlist_intersect(sl,preferredexits); smartlist_intersect(sl,preferredexits);
router = smartlist_choose(sl); router = routerlist_sl_choose_by_bandwidth(sl);
} else { } else {
/* Either there are no pending connections, or no routers even seem to /* Either there are no pending connections, or no routers even seem to
* possibly support any of them. Choose a router at random. */ * possibly support any of them. Choose a router at random. */
@ -923,7 +923,7 @@ static routerinfo_t *choose_good_exit_server_general(routerlist_t *dir)
smartlist_subtract(sl,excludedexits); smartlist_subtract(sl,excludedexits);
if (options.StrictExitNodes || smartlist_overlap(sl,preferredexits)) if (options.StrictExitNodes || smartlist_overlap(sl,preferredexits))
smartlist_intersect(sl,preferredexits); smartlist_intersect(sl,preferredexits);
router = smartlist_choose(sl); router = routerlist_sl_choose_by_bandwidth(sl);
} }
smartlist_free(preferredexits); smartlist_free(preferredexits);

View File

@ -1396,6 +1396,7 @@ int all_directory_servers_down(void);
struct smartlist_t; struct smartlist_t;
void add_nickname_list_to_smartlist(struct smartlist_t *sl, const char *list); void add_nickname_list_to_smartlist(struct smartlist_t *sl, const char *list);
int router_nickname_matches(routerinfo_t *router, const char *nickname); 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 *router_choose_random_node(char *preferred, char *excluded,
struct smartlist_t *excludedsmartlist, struct smartlist_t *excludedsmartlist,
int preferuptime, int preferbandwidth, int preferuptime, int preferbandwidth,

View File

@ -236,7 +236,7 @@ routerlist_sl_remove_unreliable_routers(smartlist_t *sl)
} }
} }
static routerinfo_t * routerinfo_t *
routerlist_sl_choose_by_bandwidth(smartlist_t *sl) routerlist_sl_choose_by_bandwidth(smartlist_t *sl)
{ {
int i; int i;