summaryrefslogtreecommitdiff
path: root/src/or/entrynodes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r--src/or/entrynodes.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 951ce15f85..1c9349ee03 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -1605,9 +1605,6 @@ entry_guards_upgrade_waiting_circuits(guard_selection_t *gs,
"circuit had higher priority, so not upgrading.",
n_complete, n_waiting);
- /* XXXX prop271 implement: "(Time them out after a
- {NONPRIMARY_GUARD_IDLE_TIMEOUT} seconds.)"
- */
return 0;
}
}
@@ -1672,6 +1669,21 @@ entry_guards_upgrade_waiting_circuits(guard_selection_t *gs,
}
/**
+ * Return true iff the circuit whose state is <b>guard_state</b> should
+ * expire.
+ */
+int
+entry_guard_state_should_expire(circuit_guard_state_t *guard_state)
+{
+ if (guard_state == NULL)
+ return 0;
+ const time_t expire_if_waiting_since =
+ approx_time() - NONPRIMARY_GUARD_IDLE_TIMEOUT;
+ return (guard_state->state == GUARD_CIRC_STATE_WAITING_FOR_BETTER_GUARD
+ && guard_state->state_set_at < expire_if_waiting_since);
+}
+
+/**
* Update all derived pieces of the guard selection state in <b>gs</b>.
* Return true iff we should stop using all previously generated circuits.
*/