aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2002-08-23 05:27:50 +0000
committerRoger Dingledine <arma@torproject.org>2002-08-23 05:27:50 +0000
commit5414786cf1447e3e994d0457adaa4ca0514acc1a (patch)
tree7e248088fc34dde33a3996700f1c0879f25cdf5f
parent08adaa4b4673024b07913104ef00f641b829e4b5 (diff)
downloadtor-5414786cf1447e3e994d0457adaa4ca0514acc1a.tar
tor-5414786cf1447e3e994d0457adaa4ca0514acc1a.tar.gz
changed path selection so it's actually random again
svn:r78
-rw-r--r--src/or/onion.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/onion.c b/src/or/onion.c
index ed8198019..015c0a2c5 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -156,15 +156,15 @@ unsigned int *new_route(double cw, routerinfo_t **rarray, size_t rarray_len, siz
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;