From b500104cbe48d072a7f3ef9135263b054fc63d76 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Wed, 18 Aug 2004 11:20:15 +0000 Subject: tolerate old 0.0.7 clients that demand a certain ip:port for a router even though it's moved on to another one. also reduce some log verbosity. svn:r2288 --- src/or/routerlist.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/or/routerlist.c') diff --git a/src/or/routerlist.c b/src/or/routerlist.c index d24286a0b..cda2ef5fd 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -152,7 +152,9 @@ int all_directory_servers_down(void) { * nicknames in list name routers in our routerlist that are * currently running. Add the routerinfos for those routers to sl. */ -void add_nickname_list_to_smartlist(smartlist_t *sl, const char *list) { +void +add_nickname_list_to_smartlist(smartlist_t *sl, const char *list, int warn_if_down) +{ const char *start,*end; char nick[MAX_HEX_NICKNAME_LEN+1]; routerinfo_t *router; @@ -177,7 +179,8 @@ void add_nickname_list_to_smartlist(smartlist_t *sl, const char *list) { if (router->is_running) smartlist_add(sl,router); else - log_fn(LOG_WARN,"Nickname list includes '%s' which is known but down.",nick); + log_fn(warn_if_down ? LOG_WARN : LOG_DEBUG, + "Nickname list includes '%s' which is known but down.",nick); } else log_fn(has_fetched_directory ? LOG_WARN : LOG_INFO, "Nickname list includes '%s' which isn't a known router.",nick); @@ -284,7 +287,7 @@ routerlist_sl_choose_by_bandwidth(smartlist_t *sl) SMARTLIST_FOREACH(bandwidths, uint32_t*, p, tor_free(p)); smartlist_free(bandwidths); router = smartlist_get(sl, i); - log_fn(LOG_INFO,"Picked %s.", router->nickname); +// log_fn(LOG_INFO,"Picked %s.", router->nickname); return router; } @@ -304,11 +307,11 @@ routerinfo_t *router_choose_random_node(char *preferred, char *excluded, routerinfo_t *choice; excludednodes = smartlist_create(); - add_nickname_list_to_smartlist(excludednodes,excluded); + add_nickname_list_to_smartlist(excludednodes,excluded,0); /* try the preferred nodes first */ sl = smartlist_create(); - add_nickname_list_to_smartlist(sl,preferred); + add_nickname_list_to_smartlist(sl,preferred,1); smartlist_subtract(sl,excludednodes); if(excludedsmartlist) smartlist_subtract(sl,excludedsmartlist); -- cgit v1.2.3