[or-cvs] router_choose_random_node wants a smartlist of routers, not...

Nick Mathewson nickm at seul.org
Tue Apr 6 21:20:01 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv32760/or

Modified Files:
	rendservice.c 
Log Message:
router_choose_random_node wants a smartlist of routers, not of nicknames.

Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- rendservice.c	6 Apr 2004 20:23:58 -0000	1.32
+++ rendservice.c	6 Apr 2004 21:19:59 -0000	1.33
@@ -651,10 +651,13 @@
   rend_service_t *service;
   char *desc, *intro;
   int changed, prev_intro_nodes, desc_len;
+  smartlist_t *intro_routers;
 
   router_get_routerlist(&rl);
+  intro_routers = smartlist_create();
 
   for (i=0; i< smartlist_len(rend_service_list); ++i) {
+    smartlist_clear(intro_routers);
     service = smartlist_get(rend_service_list, i);
 
     assert(service);
@@ -667,6 +670,7 @@
         smartlist_del(service->intro_nodes,j--);
         changed = 1;
       }
+      smartlist_add(intro_routers, router);
     }
 
     /* We have enough intro points, and the intro points we thought we had were
@@ -683,13 +687,14 @@
       router = router_choose_random_node(rl,
                                          service->intro_prefer_nodes,
                                          service->intro_exclude_nodes,
-                                         service->intro_nodes);
+                                         intro_routers);
       if (!router) {
         log_fn(LOG_WARN, "Can't establish more than %d introduction points",
                smartlist_len(service->intro_nodes));
         break;
       }
       changed = 1;
+      smartlist_add(intro_routers, router);
       smartlist_add(service->intro_nodes, tor_strdup(router->nickname));
     }
 
@@ -719,6 +724,8 @@
       }
     }
   }
+  smartlist_free(intro_routers);
+
   return 0;
 }
 



More information about the tor-commits mailing list