diff options
author | Roger Dingledine <arma@torproject.org> | 2005-03-22 01:01:15 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-03-22 01:01:15 +0000 |
commit | f1ba4296c1af488bbbf9d74fcac94461793c910f (patch) | |
tree | c32d23137de0dba298d7ce604f9f7c13a2001131 /src/or/circuitbuild.c | |
parent | 35953edae073e69efe06f4ea313066b514b772a0 (diff) | |
download | tor-f1ba4296c1af488bbbf9d74fcac94461793c910f.tar.gz tor-f1ba4296c1af488bbbf9d74fcac94461793c910f.zip |
clean up and refactor some more
svn:r3798
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r-- | src/or/circuitbuild.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 9d2b77286b..ce0127707a 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -246,7 +246,7 @@ again: return 0; /* if r == 1 */ } -/** Create and return new circuit. Initialize its purpose and +/** Create and return a new circuit. Initialize its purpose and * build-state based on our arguments. */ circuit_t * circuit_init(uint8_t purpose, int need_uptime, int need_capacity, int internal) { @@ -1168,8 +1168,9 @@ onion_pick_cpath_exit(circuit_t *circ, routerinfo_t *exit) { return 0; } -/** Take the open circ originating here, give it a new exit destination - * to <b>exit</b>, and get it to send the next extend cell. +/** Give <b>circ</b> a new exit destination to <b>exit</b>, and add a + * hop to the cpath reflecting this. Don't send the next extend cell -- + * the caller will do this if it wants to. */ int circuit_append_new_exit(circuit_t *circ, routerinfo_t *exit) { @@ -1183,6 +1184,22 @@ circuit_append_new_exit(circuit_t *circ, routerinfo_t *exit) { return 0; } +/** Take the open circ originating here, give it a new exit destination + * to <b>exit</b>, and get it to send the next extend cell. If you can't + * send the extend cell, mark the circuit for close and return -1, else + * return 0. */ +int circuit_extend_to_new_exit(circuit_t *circ, routerinfo_t *exit) { + circuit_append_new_exit(circ, exit); + circ->state = CIRCUIT_STATE_BUILDING; + if (circuit_send_next_onion_skin(circ)<0) { + log_fn(LOG_WARN, "Couldn't extend circuit to new point '%s'.", + circ->build_state->chosen_exit_name); + circuit_mark_for_close(circ); + return -1; + } + return 0; +} + /** Return the number of routers in <b>routers</b> that are currently up * and available for building circuits through. */ |