mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Merge branch 'maint-0.4.0'
This commit is contained in:
@@ -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"),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user