Move TestingMin{Exit,Fast}FlagThreshold to dirauth module.

This commit is contained in:
Nick Mathewson 2019-12-19 10:14:09 -05:00
parent cde5abfdc6
commit 3739503404
4 changed files with 10 additions and 11 deletions

View File

@ -596,8 +596,6 @@ static const config_var_t option_vars_[] = {
V(PerConnBWRate, MEMUNIT, "0"), V(PerConnBWRate, MEMUNIT, "0"),
V_IMMUTABLE(PidFile, FILENAME, NULL), V_IMMUTABLE(PidFile, FILENAME, NULL),
V_IMMUTABLE(TestingTorNetwork, BOOL, "0"), V_IMMUTABLE(TestingTorNetwork, BOOL, "0"),
V(TestingMinExitFlagThreshold, MEMUNIT, "0"),
V(TestingMinFastFlagThreshold, MEMUNIT, "0"),
V(TestingLinkCertLifetime, INTERVAL, "2 days"), V(TestingLinkCertLifetime, INTERVAL, "2 days"),
V(TestingAuthKeyLifetime, INTERVAL, "2 days"), V(TestingAuthKeyLifetime, INTERVAL, "2 days"),

View File

@ -764,12 +764,6 @@ struct or_options_t {
* of certain configuration options. */ * of certain configuration options. */
int TestingTorNetwork; int TestingTorNetwork;
/** Minimum value for the Exit flag threshold on testing networks. */
uint64_t TestingMinExitFlagThreshold;
/** Minimum value for the Fast flag threshold on testing networks. */
uint64_t TestingMinFastFlagThreshold;
/** Relays in a testing network which should be voted Exit /** Relays in a testing network which should be voted Exit
* regardless of exit policy. */ * regardless of exit policy. */
routerset_t *TestingDirAuthVoteExit; routerset_t *TestingDirAuthVoteExit;

View File

@ -70,6 +70,12 @@ CONF_VAR(RecommendedServerVersions, LINELIST, 0, NULL)
* altered on testing networks. */ * altered on testing networks. */
CONF_VAR(TestingAuthDirTimeToLearnReachability, INTERVAL, 0, "30 minutes") CONF_VAR(TestingAuthDirTimeToLearnReachability, INTERVAL, 0, "30 minutes")
/** Minimum value for the Exit flag threshold on testing networks. */
CONF_VAR(TestingMinExitFlagThreshold, MEMUNIT, 0, "0")
/** Minimum value for the Fast flag threshold on testing networks. */
CONF_VAR(TestingMinFastFlagThreshold, MEMUNIT, 0, "0")
/** Boolean: is this an authoritative directory that's willing to recommend /** Boolean: is this an authoritative directory that's willing to recommend
* versions? */ * versions? */
CONF_VAR(VersioningAuthoritativeDirectory, BOOL, 0, "0") CONF_VAR(VersioningAuthoritativeDirectory, BOOL, 0, "0")

View File

@ -147,7 +147,7 @@ router_is_active(const routerinfo_t *ri, const node_t *node, time_t now)
* if TestingTorNetwork, and TestingMinExitFlagThreshold is non-zero */ * if TestingTorNetwork, and TestingMinExitFlagThreshold is non-zero */
if (!ri->bandwidthcapacity) { if (!ri->bandwidthcapacity) {
if (get_options()->TestingTorNetwork) { if (get_options()->TestingTorNetwork) {
if (get_options()->TestingMinExitFlagThreshold > 0) { if (dirauth_get_options()->TestingMinExitFlagThreshold > 0) {
/* If we're in a TestingTorNetwork, and TestingMinExitFlagThreshold is, /* If we're in a TestingTorNetwork, and TestingMinExitFlagThreshold is,
* then require bandwidthcapacity */ * then require bandwidthcapacity */
return 0; return 0;
@ -216,9 +216,10 @@ router_counts_toward_thresholds(const node_t *node, time_t now,
dirserv_has_measured_bw(node->identity); dirserv_has_measured_bw(node->identity);
uint64_t min_bw_kb = ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER_KB; uint64_t min_bw_kb = ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER_KB;
const or_options_t *options = get_options(); const or_options_t *options = get_options();
const dirauth_options_t *dirauth_options = dirauth_get_options();
if (options->TestingTorNetwork) { if (options->TestingTorNetwork) {
min_bw_kb = (int64_t)options->TestingMinExitFlagThreshold / 1000; min_bw_kb = (int64_t)dirauth_options->TestingMinExitFlagThreshold / 1000;
} }
return node->ri && router_is_active(node->ri, node, now) && return node->ri && router_is_active(node->ri, node, now) &&
@ -341,7 +342,7 @@ dirserv_compute_performance_thresholds(digestmap_t *omit_as_sybil)
ABSOLUTE_MIN_VALUE_FOR_FAST_FLAG, ABSOLUTE_MIN_VALUE_FOR_FAST_FLAG,
INT32_MAX); INT32_MAX);
if (options->TestingTorNetwork) { if (options->TestingTorNetwork) {
min_fast = (int32_t)options->TestingMinFastFlagThreshold; min_fast = (int32_t)dirauth_options->TestingMinFastFlagThreshold;
} }
max_fast = networkstatus_get_param(NULL, "FastFlagMaxThreshold", max_fast = networkstatus_get_param(NULL, "FastFlagMaxThreshold",
INT32_MAX, min_fast, INT32_MAX); INT32_MAX, min_fast, INT32_MAX);