[or-cvs] changed path selection so it"s actually random again
Roger Dingledine
arma at seul.org
Fri Aug 23 05:27:52 UTC 2002
Update of /home/or/cvsroot/src/or
In directory moria.seul.org:/home/arma/work/onion/cvs/src/or
Modified Files:
onion.c
Log Message:
changed path selection so it's actually random again
Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- onion.c 23 Aug 2002 03:35:44 -0000 1.8
+++ onion.c 23 Aug 2002 05:27:50 -0000 1.9
@@ -156,15 +156,15 @@
choice = choice % (rarray_len);
log(LOG_DEBUG,"new_route(): Contemplating router %u.",choice);
- while(choice == oldchoice ||
+ if(choice == oldchoice ||
(oldchoice < rarray_len && !pkey_cmp(rarray[choice]->pkey, rarray[oldchoice]->pkey)) ||
!connection_twin_get_by_addr_port(rarray[choice]->addr, rarray[choice]->or_port)) {
/* Same router as last choice, or router twin,
* or no routers with that key are connected to us.
* Try again. */
log(LOG_DEBUG,"new_route(): Picked a router %d that won't work as next hop.",choice);
- choice++;
- choice = choice % (rarray_len);
+ i--;
+ continue;
}
log(LOG_DEBUG,"new_route(): Chosen router %u for hop %u.",choice,i);
oldchoice = choice;
More information about the tor-commits
mailing list