summaryrefslogtreecommitdiff
path: root/src/or/entrynodes.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2017-01-17 13:04:45 +0200
committerGeorge Kadianakis <desnacked@riseup.net>2017-01-17 14:35:38 +0200
commitdef7115fe4cab45b4e3edc8fa3d8e063f04675d3 (patch)
tree63550b7606315380b965fcc98b302fa3b1ff81a5 /src/or/entrynodes.c
parent2938fd3b859a71b9f484623b8dae61e8e7a7f7ec (diff)
downloadtor-def7115fe4cab45b4e3edc8fa3d8e063f04675d3.tar.gz
tor-def7115fe4cab45b4e3edc8fa3d8e063f04675d3.zip
prop271: Move new funcs to top, to avoid compiler warnings.
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r--src/or/entrynodes.c91
1 files changed, 46 insertions, 45 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 2b7023080b..e26f32d56e 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -570,6 +570,52 @@ get_extreme_restriction_threshold(void)
1, INT32_MAX);
return pct / 100.0;
}
+
+/* Mark <b>guard</b> as maybe reachable again. */
+static void
+mark_guard_maybe_reachable(entry_guard_t *guard)
+{
+ if (guard->is_reachable != GUARD_REACHABLE_NO) {
+ return;
+ }
+
+ /* Note that we do not clear failing_since: this guard is now only
+ * _maybe-reachable_. */
+ guard->is_reachable = GUARD_REACHABLE_MAYBE;
+ if (guard->is_filtered_guard)
+ guard->is_usable_filtered_guard = 1;
+}
+
+/**
+ * Called when the network comes up after having seemed to be down for
+ * a while: Mark the primary guards as maybe-reachable so that we'll
+ * try them again.
+ */
+STATIC void
+mark_primary_guards_maybe_reachable(guard_selection_t *gs)
+{
+ tor_assert(gs);
+
+ if (!gs->primary_guards_up_to_date)
+ entry_guards_update_primary(gs);
+
+ SMARTLIST_FOREACH_BEGIN(gs->primary_entry_guards, entry_guard_t *, guard) {
+ mark_guard_maybe_reachable(guard);
+ } SMARTLIST_FOREACH_END(guard);
+}
+
+/* Called when we exhaust all guards in our sampled set: Marks all guards as
+ maybe-reachable so that we 'll try them again. */
+static void
+mark_all_guards_maybe_reachable(guard_selection_t *gs)
+{
+ tor_assert(gs);
+
+ SMARTLIST_FOREACH_BEGIN(gs->sampled_entry_guards, entry_guard_t *, guard) {
+ mark_guard_maybe_reachable(guard);
+ } SMARTLIST_FOREACH_END(guard);
+}
+
/**@}*/
/**
@@ -1939,51 +1985,6 @@ entry_guards_note_guard_failure(guard_selection_t *gs,
entry_guard_describe(guard));
}
-/* Mark <b>guard</b> as maybe reachable again. */
-static void
-mark_guard_maybe_reachable(entry_guard_t *guard)
-{
- if (guard->is_reachable != GUARD_REACHABLE_NO) {
- return;
- }
-
- /* Note that we do not clear failing_since: this guard is now only
- * _maybe-reachable_. */
- guard->is_reachable = GUARD_REACHABLE_MAYBE;
- if (guard->is_filtered_guard)
- guard->is_usable_filtered_guard = 1;
-}
-
-/**
- * Called when the network comes up after having seemed to be down for
- * a while: Mark the primary guards as maybe-reachable so that we'll
- * try them again.
- */
-STATIC void
-mark_primary_guards_maybe_reachable(guard_selection_t *gs)
-{
- tor_assert(gs);
-
- if (!gs->primary_guards_up_to_date)
- entry_guards_update_primary(gs);
-
- SMARTLIST_FOREACH_BEGIN(gs->primary_entry_guards, entry_guard_t *, guard) {
- mark_guard_maybe_reachable(guard);
- } SMARTLIST_FOREACH_END(guard);
-}
-
-/* Called when we exhaust all guards in our sampled set: Marks all guards as
- * maybe-reachable so that we 'll try them again. */
-static void
-mark_all_guards_maybe_reachable(guard_selection_t *gs)
-{
- tor_assert(gs);
-
- SMARTLIST_FOREACH_BEGIN(gs->sampled_entry_guards, entry_guard_t *, guard) {
- mark_guard_maybe_reachable(guard);
- } SMARTLIST_FOREACH_END(guard);
-}
-
/**
* Note that we successfully connected to, and built a circuit through
* <b>guard</b>. Given the old guard-state of the circuit in <b>old_state</b>,