aboutsummaryrefslogtreecommitdiff
path: root/src/or/onion.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/onion.c')
-rw-r--r--src/or/onion.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/or/onion.c b/src/or/onion.c
index 2804732d2..996d56a5c 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -4,6 +4,8 @@
#include "or.h"
+extern int global_role; /* from main.c */
+
/********* START VARIABLES **********/
tracked_onion_t *tracked_onions = NULL; /* linked list of tracked onions */
@@ -109,8 +111,9 @@ unsigned int *new_route(double cw, routerinfo_t **rarray, int rarray_len, int *r
log(LOG_DEBUG,"new_route(): Chosen route length %d.",*routelen);
for(i=0;i<rarray_len;i++) {
- log(LOG_DEBUG,"Contemplating whether router %d is any good...",i);
- if(!connection_exact_get_by_addr_port(rarray[i]->addr, rarray[i]->or_port)) {
+ log(LOG_DEBUG,"Contemplating whether router %d is a new option...",i);
+ if( (global_role & ROLE_OR_CONNECT_ALL) &&
+ !connection_exact_get_by_addr_port(rarray[i]->addr, rarray[i]->or_port)) {
log(LOG_DEBUG,"Nope, %d is not connected.",i);
goto next_i_loop;
}
@@ -156,7 +159,7 @@ unsigned int *new_route(double cw, routerinfo_t **rarray, int rarray_len, int *r
log(LOG_DEBUG,"new_route(): Contemplating router %u.",choice);
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)) {
+ ((global_role & ROLE_OR_CONNECT_ALL) && !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. */