Преглед изворни кода

bugfix: we were ignoring the IS_FAST flag in the directory
status, meaning we were willing to pick trivial-bandwidth nodes
for "fast" connections.


svn:r5992

Roger Dingledine пре 19 година
родитељ
комит
b7781ea208
1 измењених фајлова са 6 додато и 5 уклоњено
  1. 6 5
      src/or/routerlist.c

+ 6 - 5
src/or/routerlist.c

@@ -726,15 +726,16 @@ router_is_unreliable(routerinfo_t *router, int need_uptime,
 /** Remove from routerlist <b>sl</b> all routers that are not
 /** Remove from routerlist <b>sl</b> all routers that are not
  * sufficiently stable. */
  * sufficiently stable. */
 static void
 static void
-routerlist_sl_remove_unreliable_routers(smartlist_t *sl,
-                                        int need_uptime, int need_guard)
+routerlist_sl_remove_unreliable_routers(smartlist_t *sl, int need_uptime,
+                                        int need_capacity, int need_guard)
 {
 {
   int i;
   int i;
   routerinfo_t *router;
   routerinfo_t *router;
 
 
   for (i = 0; i < smartlist_len(sl); ++i) {
   for (i = 0; i < smartlist_len(sl); ++i) {
     router = smartlist_get(sl, i);
     router = smartlist_get(sl, i);
-    if (router_is_unreliable(router, need_uptime, 0, need_guard)) {
+    if (router_is_unreliable(router, need_uptime,
+                             need_capacity, need_guard)) {
 //      log(LOG_DEBUG, "Router '%s' has insufficient uptime; deleting.",
 //      log(LOG_DEBUG, "Router '%s' has insufficient uptime; deleting.",
  //         router->nickname);
  //         router->nickname);
       smartlist_del(sl, i--);
       smartlist_del(sl, i--);
@@ -838,8 +839,8 @@ router_choose_random_node(const char *preferred,
     smartlist_subtract(sl,excludednodes);
     smartlist_subtract(sl,excludednodes);
     if (excludedsmartlist)
     if (excludedsmartlist)
       smartlist_subtract(sl,excludedsmartlist);
       smartlist_subtract(sl,excludedsmartlist);
-    if (need_uptime || need_guard)
-      routerlist_sl_remove_unreliable_routers(sl, need_uptime, need_guard);
+    routerlist_sl_remove_unreliable_routers(sl, need_uptime,
+                                            need_capacity, need_guard);
     if (need_capacity)
     if (need_capacity)
       choice = routerlist_sl_choose_by_bandwidth(sl);
       choice = routerlist_sl_choose_by_bandwidth(sl);
     else
     else