Skip to content

Commit

Permalink
Move TestingMin{Exit,Fast}FlagThreshold to dirauth module.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmathewson committed Dec 19, 2019
1 parent cde5abf commit 3739503
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/app/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,6 @@ static const config_var_t option_vars_[] = {
V(PerConnBWRate, MEMUNIT, "0"),
V_IMMUTABLE(PidFile, FILENAME, NULL),
V_IMMUTABLE(TestingTorNetwork, BOOL, "0"),
V(TestingMinExitFlagThreshold, MEMUNIT, "0"),
V(TestingMinFastFlagThreshold, MEMUNIT, "0"),

V(TestingLinkCertLifetime, INTERVAL, "2 days"),
V(TestingAuthKeyLifetime, INTERVAL, "2 days"),
Expand Down
6 changes: 0 additions & 6 deletions src/app/config/or_options_st.h
Original file line number Diff line number Diff line change
Expand Up @@ -764,12 +764,6 @@ struct or_options_t {
* of certain configuration options. */
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
* regardless of exit policy. */
routerset_t *TestingDirAuthVoteExit;
Expand Down
6 changes: 6 additions & 0 deletions src/feature/dirauth/dirauth_options.inc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ CONF_VAR(RecommendedServerVersions, LINELIST, 0, NULL)
* altered on testing networks. */
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
* versions? */
CONF_VAR(VersioningAuthoritativeDirectory, BOOL, 0, "0")
Expand Down
7 changes: 4 additions & 3 deletions src/feature/dirauth/voteflags.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 (!ri->bandwidthcapacity) {
if (get_options()->TestingTorNetwork) {
if (get_options()->TestingMinExitFlagThreshold > 0) {
if (dirauth_get_options()->TestingMinExitFlagThreshold > 0) {
/* If we're in a TestingTorNetwork, and TestingMinExitFlagThreshold is,
* then require bandwidthcapacity */
return 0;
Expand Down Expand Up @@ -216,9 +216,10 @@ router_counts_toward_thresholds(const node_t *node, time_t now,
dirserv_has_measured_bw(node->identity);
uint64_t min_bw_kb = ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER_KB;
const or_options_t *options = get_options();
const dirauth_options_t *dirauth_options = dirauth_get_options();

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) &&
Expand Down Expand Up @@ -341,7 +342,7 @@ dirserv_compute_performance_thresholds(digestmap_t *omit_as_sybil)
ABSOLUTE_MIN_VALUE_FOR_FAST_FLAG,
INT32_MAX);
if (options->TestingTorNetwork) {
min_fast = (int32_t)options->TestingMinFastFlagThreshold;
min_fast = (int32_t)dirauth_options->TestingMinFastFlagThreshold;
}
max_fast = networkstatus_get_param(NULL, "FastFlagMaxThreshold",
INT32_MAX, min_fast, INT32_MAX);
Expand Down

0 comments on commit 3739503

Please sign in to comment.