aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitlist.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-08-19 07:04:24 +0000
committerRoger Dingledine <arma@torproject.org>2007-08-19 07:04:24 +0000
commit03560d575e16ddcf980bc7b2f8ee2f9689c2ccb0 (patch)
treebd4ac3a97a371e0711c44fdf4f9109f8244521b5 /src/or/circuitlist.c
parent455862db1a0addbd7edb8876a5c837c862cd5938 (diff)
downloadtor-03560d575e16ddcf980bc7b2f8ee2f9689c2ccb0.tar.gz
tor-03560d575e16ddcf980bc7b2f8ee2f9689c2ccb0.zip
generalize circuit_find_to_cannibalize() so it knows what
purpose circuit we're planning to become svn:r11184
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r--src/or/circuitlist.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index f199af2062..fa03c35151 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -787,7 +787,7 @@ circuit_get_intro_point(const char *digest)
DIGEST_LEN);
}
-/** Return a circuit that is open, has specified <b>purpose</b>,
+/** Return a circuit that is open, is CIRCUIT_PURPOSE_C_GENERAL,
* has a timestamp_dirty value of 0, is uptime/capacity/internal
* if required, and if info is defined, does not already use info
* as any of its hops; or NULL if no circuit fits this description.
@@ -801,6 +801,7 @@ circuit_find_to_cannibalize(uint8_t purpose, extend_info_t *info,
{
circuit_t *_circ;
origin_circuit_t *best=NULL;
+ or_options_t *options = get_options();
log_debug(LD_CIRC,
"Hunting for a circ to cannibalize: purpose %d, uptime %d, "
@@ -811,9 +812,17 @@ circuit_find_to_cannibalize(uint8_t purpose, extend_info_t *info,
if (CIRCUIT_IS_ORIGIN(_circ) &&
_circ->state == CIRCUIT_STATE_OPEN &&
!_circ->marked_for_close &&
- _circ->purpose == purpose &&
+ _circ->purpose == CIRCUIT_PURPOSE_C_GENERAL &&
!_circ->timestamp_dirty) {
origin_circuit_t *circ = TO_ORIGIN_CIRCUIT(_circ);
+#if 0 /* XXX here while roger investigates a reported RendNodes bug */
+ if (_circ->purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND &&
+ options->RendNodes) {
+ routerinfo_t *exit = build_state_get_exit_router(circ->build_state);
+ if (exit && !router_nickname_is_in_list(exit, options->RendNodes))
+ continue; /* not one of our allowed RendNodes */
+ }
+#endif
if ((!need_uptime || circ->build_state->need_uptime) &&
(!need_capacity || circ->build_state->need_capacity) &&
(internal == circ->build_state->is_internal)) {