|
@@ -2017,7 +2017,7 @@ void
|
|
router_add_running_nodes_to_smartlist(smartlist_t *sl, int allow_invalid,
|
|
router_add_running_nodes_to_smartlist(smartlist_t *sl, int allow_invalid,
|
|
int need_uptime, int need_capacity,
|
|
int need_uptime, int need_capacity,
|
|
int need_guard, int need_desc,
|
|
int need_guard, int need_desc,
|
|
- int pref_addr)
|
|
+ int pref_addr, int direct_conn)
|
|
{
|
|
{
|
|
const int check_reach = !router_skip_or_reachability(get_options(),
|
|
const int check_reach = !router_skip_or_reachability(get_options(),
|
|
pref_addr);
|
|
pref_addr);
|
|
@@ -2032,10 +2032,10 @@ router_add_running_nodes_to_smartlist(smartlist_t *sl, int allow_invalid,
|
|
continue;
|
|
continue;
|
|
if (node_is_unreliable(node, need_uptime, need_capacity, need_guard))
|
|
if (node_is_unreliable(node, need_uptime, need_capacity, need_guard))
|
|
continue;
|
|
continue;
|
|
-
|
|
+
|
|
- if (check_reach && !fascist_firewall_allows_node(node,
|
|
+ * if we are making a direct connection */
|
|
- FIREWALL_OR_CONNECTION,
|
|
+ if (direct_conn && check_reach &&
|
|
- pref_addr))
|
|
+ !fascist_firewall_allows_node(node, FIREWALL_OR_CONNECTION, pref_addr))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
smartlist_add(sl, (void *)node);
|
|
smartlist_add(sl, (void *)node);
|
|
@@ -2515,6 +2515,7 @@ router_choose_random_node(smartlist_t *excludedsmartlist,
|
|
const int weight_for_exit = (flags & CRN_WEIGHT_AS_EXIT) != 0;
|
|
const int weight_for_exit = (flags & CRN_WEIGHT_AS_EXIT) != 0;
|
|
const int need_desc = (flags & CRN_NEED_DESC) != 0;
|
|
const int need_desc = (flags & CRN_NEED_DESC) != 0;
|
|
const int pref_addr = (flags & CRN_PREF_ADDR) != 0;
|
|
const int pref_addr = (flags & CRN_PREF_ADDR) != 0;
|
|
|
|
+ const int direct_conn = (flags & CRN_DIRECT_CONN) != 0;
|
|
|
|
|
|
smartlist_t *sl=smartlist_new(),
|
|
smartlist_t *sl=smartlist_new(),
|
|
*excludednodes=smartlist_new();
|
|
*excludednodes=smartlist_new();
|
|
@@ -2540,7 +2541,8 @@ router_choose_random_node(smartlist_t *excludedsmartlist,
|
|
|
|
|
|
router_add_running_nodes_to_smartlist(sl, allow_invalid,
|
|
router_add_running_nodes_to_smartlist(sl, allow_invalid,
|
|
need_uptime, need_capacity,
|
|
need_uptime, need_capacity,
|
|
- need_guard, need_desc, pref_addr);
|
|
+ need_guard, need_desc, pref_addr,
|
|
|
|
+ direct_conn);
|
|
log_debug(LD_CIRC,
|
|
log_debug(LD_CIRC,
|
|
"We found %d running nodes.",
|
|
"We found %d running nodes.",
|
|
smartlist_len(sl));
|
|
smartlist_len(sl));
|