|
@@ -4,6 +4,8 @@
|
|
|
|
|
|
|
|
#include "or.h"
|
|
#include "or.h"
|
|
|
|
|
|
|
|
|
|
+extern int global_role; /* from main.c */
|
|
|
|
|
+
|
|
|
/********* START VARIABLES **********/
|
|
/********* START VARIABLES **********/
|
|
|
|
|
|
|
|
tracked_onion_t *tracked_onions = NULL; /* linked list of tracked onions */
|
|
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);
|
|
log(LOG_DEBUG,"new_route(): Chosen route length %d.",*routelen);
|
|
|
|
|
|
|
|
for(i=0;i<rarray_len;i++) {
|
|
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);
|
|
log(LOG_DEBUG,"Nope, %d is not connected.",i);
|
|
|
goto next_i_loop;
|
|
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);
|
|
log(LOG_DEBUG,"new_route(): Contemplating router %u.",choice);
|
|
|
if(choice == oldchoice ||
|
|
if(choice == oldchoice ||
|
|
|
(oldchoice < rarray_len && !pkey_cmp(rarray[choice]->pkey, rarray[oldchoice]->pkey)) ||
|
|
(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,
|
|
/* Same router as last choice, or router twin,
|
|
|
* or no routers with that key are connected to us.
|
|
* or no routers with that key are connected to us.
|
|
|
* Try again. */
|
|
* Try again. */
|