summaryrefslogtreecommitdiff
path: root/src/or/onion.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2002-07-18 23:44:57 +0000
committerRoger Dingledine <arma@torproject.org>2002-07-18 23:44:57 +0000
commit2147898577cdf1664ffbf16f48067c18a841593d (patch)
treec37968ca751bb1721ac68a3cd6adaac13b68ee68 /src/or/onion.c
parent0a8d58138df722194517ac65abe6716bf404df3b (diff)
downloadtor-2147898577cdf1664ffbf16f48067c18a841593d.tar.gz
tor-2147898577cdf1664ffbf16f48067c18a841593d.zip
Implemented router twins
I modified new_route so we don't pick twins back-to-back in the path. I also had to patch my previous uses of connection_twin_get_by_addr_port() because they assumed that "addr" and "port" would be the same for a twin as for the original router. svn:r56
Diffstat (limited to 'src/or/onion.c')
-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 506eb25e9b..52ef72f407 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -131,9 +131,9 @@ unsigned int *new_route(double cw, routerinfo_t **rarray, size_t rarray_len, siz
choice = choice % (rarray_len);
log(LOG_DEBUG,"new_route() : Chosen router %u.",choice);
- if (choice == oldchoice) /* same router */
- {
- /* try again */
+ if (choice == oldchoice ||
+ (oldchoice < rarray_len && !pkey_cmp(rarray[choice]->pkey, rarray[oldchoice]->pkey))) {
+ /* same router, or router twin. try again. */
i--;
continue;
}