]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
when we try to exclude our routerinfo from being picked in the
authorRoger Dingledine <arma@torproject.org>
Wed, 18 Aug 2004 10:32:50 +0000 (10:32 +0000)
committerRoger Dingledine <arma@torproject.org>
Wed, 18 Aug 2004 10:32:50 +0000 (10:32 +0000)
path, it fails because we're using a pointer to the routerinfo we
generate, not a pointer to the routerinfo in the routerlist. so look
up the right one and use that.

svn:r2286

src/or/circuitbuild.c
src/or/or.h
src/or/routerlist.c

index acc2deb375c662944e32f27e9a137b41bf3ab521..9a4549258919bd3c7cdc0f66359fd4c0305b65ec 100644 (file)
@@ -1098,7 +1098,7 @@ static routerinfo_t *choose_good_middle_server(cpath_build_state_t *state,
   excluded = smartlist_create();
   if((r = router_get_by_digest(state->chosen_exit_digest)))
     smartlist_add(excluded, r);
-  if((r = router_get_my_routerinfo()))
+  if((r = routerlist_find_my_routerinfo()))
     smartlist_add(excluded, r);
   for (i = 0, cpath = head; i < cur_len; ++i, cpath=cpath->next) {
     r = router_get_by_digest(cpath->identity_digest);
@@ -1119,7 +1119,7 @@ static routerinfo_t *choose_good_entry_server(cpath_build_state_t *state)
 
   if((r = router_get_by_digest(state->chosen_exit_digest)))
     smartlist_add(excluded, r);
-  if((r = router_get_my_routerinfo()))
+  if((r = routerlist_find_my_routerinfo()))
     smartlist_add(excluded, r);
   if(options.FascistFirewall) {
     /* exclude all ORs that listen on the wrong port */
index 38f489918517d7fb326ca7d9d5550c6954dca36c..36fd64fbe0026b8bccd66adb6935b9f3c274c598 100644 (file)
@@ -1395,6 +1395,7 @@ routerinfo_t *router_pick_directory_server(int requireauth, int requireothers);
 int all_directory_servers_down(void);
 struct smartlist_t;
 void add_nickname_list_to_smartlist(struct smartlist_t *sl, const char *list);
+routerinfo_t *routerlist_find_my_routerinfo(void);
 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,
index 3995fd7d98be60a57048840c3070b1fad611f3b9..d24286a0b0026ed5061c32f4c5e571a5f8808026 100644 (file)
@@ -207,6 +207,22 @@ router_add_running_routers_to_smartlist(smartlist_t *sl, int allow_unverified)
   }
 }
 
+routerinfo_t *
+routerlist_find_my_routerinfo(void) {
+  routerinfo_t *router;
+  int i;
+
+  if(!routerlist)
+    return NULL;
+
+  for(i=0;i<smartlist_len(routerlist->routers);i++) {
+    router = smartlist_get(routerlist->routers, i);
+    if(router_is_me(router))
+      return router;
+  }
+  return NULL;
+}
+
 /** How many seconds a router must be up before we'll use it for
  * reliability-critical node positions.
  */