summaryrefslogtreecommitdiff
path: root/src/or/circuituse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-11-25 12:53:00 -0500
committerNick Mathewson <nickm@torproject.org>2016-12-16 11:06:16 -0500
commit2ea5aa71823f385e36f20e643a20996dcb164464 (patch)
tree3a1d70c711bdd1fdf0917c2b43bf8c9fb8f3b2a4 /src/or/circuituse.c
parente56bc1e5de05d9bc6876d91d364d33f0771eb322 (diff)
downloadtor-2ea5aa71823f385e36f20e643a20996dcb164464.tar.gz
tor-2ea5aa71823f385e36f20e643a20996dcb164464.zip
Expire circuits that have been WAITING_FOR_BETTER_GUARD too long
(This is required by 3.9 in prop271, but is better done as a separate function IMO)
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r--src/or/circuituse.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index b9f94fb3a2..b925729e01 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -800,6 +800,25 @@ circuit_expire_building(void)
} SMARTLIST_FOREACH_END(victim);
}
+/**
+ * Mark for close all circuits that start here, that were built through a
+ * guard we weren't sure if we wanted to use, and that have been waiting
+ * around for way too long.
+ */
+void
+circuit_expire_waiting_for_better_guard(void)
+{
+ SMARTLIST_FOREACH_BEGIN(circuit_get_global_origin_circuit_list(),
+ origin_circuit_t *, circ) {
+ if (TO_CIRCUIT(circ)->marked_for_close)
+ continue;
+ if (circ->guard_state == NULL)
+ continue;
+ if (entry_guard_state_should_expire(circ->guard_state))
+ circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_NONE);
+ } SMARTLIST_FOREACH_END(circ);
+}
+
/** For debugging #8387: track when we last called
* circuit_expire_old_circuits_clientside. */
static time_t last_expired_clientside_circuits = 0;