Merge branch 'maint-0.4.0'

This commit is contained in:
George Kadianakis
2019-04-05 14:51:33 +03:00
6 changed files with 40 additions and 0 deletions
+1
View File
@@ -398,6 +398,7 @@ static config_var_t option_vars_[] = {
V(DormantClientTimeout, INTERVAL, "24 hours"),
V(DormantTimeoutDisabledByIdleStreams, BOOL, "1"),
V(DormantOnFirstStartup, BOOL, "0"),
V(DormantCanceledByStartup, BOOL, "0"),
/* DoS circuit creation options. */
V(DoSCircuitCreationEnabled, AUTOBOOL, "auto"),
V(DoSCircuitCreationMinConnections, UINT, "0"),
+5
View File
@@ -1092,6 +1092,11 @@ struct or_options_t {
/** Boolean: true if Tor should be dormant the first time it starts with
* a datadirectory; false otherwise. */
int DormantOnFirstStartup;
/**
* Boolean: true if Tor should treat every startup event as cancelling
* a possible previous dormant state.
**/
int DormantCanceledByStartup;
};
#endif
+4
View File
@@ -144,6 +144,10 @@ netstatus_load_from_state(const or_state_t *state, time_t now)
last_activity = now - 60 * state->MinutesSinceUserActivity;
participating_on_network = true;
}
if (get_options()->DormantCanceledByStartup) {
last_activity = now;
participating_on_network = true;
}
reset_user_activity(last_activity);
}
+8
View File
@@ -317,6 +317,14 @@ test_mainloop_dormant_load_state(void *arg)
tt_assert(is_participating_on_network());
tt_i64_op(get_last_user_activity_time(), OP_EQ, start - 123*60);
// If we would start dormant, but DormantCanceledByStartup is set, then
// we start up non-dormant.
state->Dormant = 1;
get_options_mutable()->DormantCanceledByStartup = 1;
netstatus_load_from_state(state, start);
tt_assert(is_participating_on_network());
tt_i64_op(get_last_user_activity_time(), OP_EQ, start);
done:
or_state_free(state);
}