More debugging code for node_t branch

This commit is contained in:
Nick Mathewson 2010-10-01 19:52:05 -04:00
parent 1bb9734e3a
commit b9f2ccbdcc
2 changed files with 14 additions and 6 deletions

View File

@ -2564,7 +2564,7 @@ choose_good_exit_server_general(int need_uptime, int need_capacity)
*/ */
continue; continue;
} }
if (!node->ri && !(node->rs && node->md)) if (!node_has_descriptor(node))
continue; continue;
if (!node->is_running || node->is_bad_exit) { if (!node->is_running || node->is_bad_exit) {
n_supported[i] = -1; n_supported[i] = -1;
@ -2684,6 +2684,8 @@ choose_good_exit_server_general(int need_uptime, int need_capacity)
/* try once to pick only from routers that satisfy a needed port, /* try once to pick only from routers that satisfy a needed port,
* then if there are none, pick from any that support exiting. */ * then if there are none, pick from any that support exiting. */
SMARTLIST_FOREACH_BEGIN(the_nodes, const node_t *, node) { SMARTLIST_FOREACH_BEGIN(the_nodes, const node_t *, node) {
if (!node_has_descriptor(node))
continue;
if (n_supported[node_sl_idx] != -1 && if (n_supported[node_sl_idx] != -1 &&
(attempt || node_handles_some_port(node, needed_ports))) { (attempt || node_handles_some_port(node, needed_ports))) {
// log_fn(LOG_DEBUG,"Try %d: '%s' is a possibility.", // log_fn(LOG_DEBUG,"Try %d: '%s' is a possibility.",
@ -2860,6 +2862,7 @@ onion_pick_cpath_exit(origin_circuit_t *circ, extend_info_t *exit)
return -1; return -1;
} }
exit = extend_info_from_node(node); exit = extend_info_from_node(node);
tor_assert(exit);
} }
state->chosen_exit = exit; state->chosen_exit = exit;
return 0; return 0;
@ -3100,13 +3103,17 @@ onion_extend_cpath(origin_circuit_t *circ)
info = extend_info_dup(state->chosen_exit); info = extend_info_dup(state->chosen_exit);
} else if (cur_len == 0) { /* picking first node */ } else if (cur_len == 0) { /* picking first node */
const node_t *r = choose_good_entry_server(purpose, state); const node_t *r = choose_good_entry_server(purpose, state);
if (r) if (r) {
info = extend_info_from_node(r); info = extend_info_from_node(r);
tor_assert(info);
}
} else { } else {
const node_t *r = const node_t *r =
choose_good_middle_server(purpose, state, circ->cpath, cur_len); choose_good_middle_server(purpose, state, circ->cpath, cur_len);
if (r) if (r) {
info = extend_info_from_node(r); info = extend_info_from_node(r);
tor_assert(info);
}
} }
if (!info) { if (!info) {

View File

@ -593,9 +593,10 @@ node_get_verbose_nickname(const node_t *node,
int int
node_allows_single_hop_exits(const node_t *node) node_allows_single_hop_exits(const node_t *node)
{ {
(void)node; if (node && node->ri)
UNIMPLEMENTED_NODELIST(); return node->ri->allow_single_hop_exits;
return 0; else
return 0;
} }
/** Return true iff it seems that <b>node</b> has an exit policy that doesn't /** Return true iff it seems that <b>node</b> has an exit policy that doesn't