[or-cvs] when we try to exclude our routerinfo from being picked in ...
Roger Dingledine
arma at seul.org
Wed Aug 18 10:32:52 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
circuitbuild.c or.h routerlist.c
Log Message:
when we try to exclude our routerinfo from being picked in the
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.
Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuitbuild.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- circuitbuild.c 18 Aug 2004 09:07:11 -0000 1.29
+++ circuitbuild.c 18 Aug 2004 10:32:50 -0000 1.30
@@ -1098,7 +1098,7 @@
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 @@
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: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.412
retrieving revision 1.413
diff -u -d -r1.412 -r1.413
--- or.h 18 Aug 2004 08:51:04 -0000 1.412
+++ or.h 18 Aug 2004 10:32:50 -0000 1.413
@@ -1395,6 +1395,7 @@
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: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- routerlist.c 18 Aug 2004 09:07:11 -0000 1.129
+++ routerlist.c 18 Aug 2004 10:32:50 -0000 1.130
@@ -207,6 +207,22 @@
}
}
+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.
*/
More information about the tor-commits
mailing list