aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitlist.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-04-30 11:10:45 +0000
committerRoger Dingledine <arma@torproject.org>2007-04-30 11:10:45 +0000
commit5ba4eaba1cfe1858cc152a9945d0bb6c2d1838b4 (patch)
treeb92b562a0567adea1d6b2855e5ad1243f7aa53fb /src/or/circuitlist.c
parent2711ac2f6265eb981f1f7b5679fecd6af8682c3c (diff)
downloadtor-5ba4eaba1cfe1858cc152a9945d0bb6c2d1838b4.tar.gz
tor-5ba4eaba1cfe1858cc152a9945d0bb6c2d1838b4.zip
Let the controller specify HOP=%d as an argument to ATTACHSTREAM,
so we can exit from the middle of the circuit. svn:r10056
Diffstat (limited to 'src/or/circuitlist.c')
-rw-r--r--src/or/circuitlist.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 73ca7e1fa0..839d2b6dc7 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -844,6 +844,22 @@ circuit_get_cpath_len(origin_circuit_t *circ)
return n;
}
+/** Return the <b>hopnum</b>th hop in <b>circ</b>->cpath, or NULL if there
+ * aren't that many hops in the list. */
+crypt_path_t *
+circuit_get_cpath_hop(origin_circuit_t *circ, int hopnum)
+{
+ if (circ && circ->cpath) {
+ crypt_path_t *cpath, *cpath_next = NULL;
+ for (cpath = circ->cpath; cpath_next != circ->cpath; cpath = cpath_next) {
+ cpath_next = cpath->next;
+ if (--hopnum <= 0)
+ return cpath;
+ }
+ }
+ return NULL;
+}
+
/** Go through the circuitlist; mark-for-close each circuit that starts
* at us but has not yet been used. */
void