summaryrefslogtreecommitdiff
path: root/src/or/circuitbuild.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-11-18 16:05:09 -0500
committerNick Mathewson <nickm@torproject.org>2016-11-30 14:42:52 -0500
commitdd6bdab3f6254e7245f8ee76b2c6b4314f0472fa (patch)
treec8c4c6ebcb908bbc263fec2038eba1ed29aba792 /src/or/circuitbuild.c
parent7bf946965bad88116582dfd3d20e5837eeddd758 (diff)
downloadtor-dd6bdab3f6254e7245f8ee76b2c6b4314f0472fa.tar.gz
tor-dd6bdab3f6254e7245f8ee76b2c6b4314f0472fa.zip
Write the easy parts of the public entryguard interface.
Here we add a little bit of state to origin circuits, and set up the necessary functions for the circuit code to call in order to find guards, use guards, and decide when circuits can be used. There's also an incomplete function for the hard part of the circuit-maintenance code, where we figure out whether any waiting guards are ready to become usable. (This patch finally uses the handle.c code to make safe handles to entry_guard_t objects, so that we are allowed to free an entry_guard_t without checking whether any origin_circuit_t is holding a reference to it.)
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r--src/or/circuitbuild.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index b482e7818d..a33c2ca654 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -519,6 +519,13 @@ circuit_establish_circuit(uint8_t purpose, extend_info_t *exit_ei, int flags)
return circ;
}
+/** Return the guard state associated with <b>circ</b>, which may be NULL. */
+circuit_guard_state_t *
+origin_circuit_get_guard_state(origin_circuit_t *circ)
+{
+ return circ->guard_state;
+}
+
/** Start establishing the first hop of our circuit. Figure out what
* OR we should connect to, and if necessary start the connection to
* it. If we're already connected, then send the 'create' cell.