slight tweak on circuit_conforms_to_options

this function really needs to get a total rewrite (or die)

For now, use #if 0 to disable it.
This commit is contained in:
Roger Dingledine
2011-03-11 03:22:53 -05:00
committed by Nick Mathewson
parent 4906188b62
commit 7e2e8074d5
2 changed files with 15 additions and 12 deletions
+13 -12
View File
@@ -242,33 +242,34 @@ circuit_get_best(edge_connection_t *conn, int must_be_open, uint8_t purpose,
return best ? TO_ORIGIN_CIRCUIT(best) : NULL;
}
#if 0
/** Check whether, according to the policies in <b>options</b>, the
* circuit <b>circ</b> makes sense. */
/* XXXX currently only checks Exclude{Exit}Nodes. It should check more. */
/* XXXX currently only checks Exclude{Exit}Nodes; it should check more.
* Also, it doesn't have the right definition of an exit circuit. Also,
* it's never called. */
int
circuit_conforms_to_options(const origin_circuit_t *circ,
const or_options_t *options)
{
const crypt_path_t *cpath, *cpath_next = NULL;
for (cpath = circ->cpath; cpath && cpath_next != circ->cpath;
cpath = cpath_next) {
/* first check if it includes any excluded nodes */
for (cpath = circ->cpath; cpath_next != circ->cpath; cpath = cpath_next) {
cpath_next = cpath->next;
if (routerset_contains_extendinfo(options->ExcludeNodes,
cpath->extend_info))
return 0;
if (cpath->next == circ->cpath) {
/* This is apparently the exit node. */
if (routerset_contains_extendinfo(options->ExcludeExitNodes,
cpath->extend_info))
return 0;
}
}
/* then consider the final hop */
if (routerset_contains_extendinfo(options->ExcludeExitNodes,
circ->cpath->prev->extend_info))
return 0;
return 1;
}
#endif
/** Close all circuits that start at us, aren't open, and were born
* at least CircuitBuildTimeout seconds ago.
+2
View File
@@ -16,8 +16,10 @@ void circuit_expire_building(void);
void circuit_remove_handled_ports(smartlist_t *needed_ports);
int circuit_stream_is_being_handled(edge_connection_t *conn, uint16_t port,
int min);
#if 0
int circuit_conforms_to_options(const origin_circuit_t *circ,
const or_options_t *options);
#endif
void circuit_build_needed_circs(time_t now);
void circuit_detach_stream(circuit_t *circ, edge_connection_t *conn);