Merge remote-tracking branch 'github/ticket23354'
This commit is contained in:
commit
6cb467b462
|
@ -0,0 +1,6 @@
|
|||
o Minor features (configuration):
|
||||
- The "DownloadSchedule" options have been renamed to end with
|
||||
"DownloadInitialDelay". The old names are still allowed, but will
|
||||
produce a warning. Comma-separated lists are still permitted for
|
||||
these options, but all values after the first are ignored (as they have
|
||||
been since 0.2.9). Closes ticket 23354.
|
|
@ -1742,32 +1742,29 @@ The following options are useful only for clients (that is, if
|
|||
directory authorities do not choose a value, Tor will default to 0.6.
|
||||
(Default: -1)
|
||||
|
||||
[[ClientBootstrapConsensusAuthorityDownloadSchedule]] **ClientBootstrapConsensusAuthorityDownloadSchedule** __N__,__N__,__...__::
|
||||
Schedule for when clients should download consensuses from authorities
|
||||
[[ClientBootstrapConsensusAuthorityDownloadInitialDelay]] **ClientBootstrapConsensusAuthorityDownloadInitialDelay** __N__::
|
||||
Initial delay in seconds for when clients should download consensuses from authorities
|
||||
if they are bootstrapping (that is, they don't have a usable, reasonably
|
||||
live consensus). Only used by clients fetching from a list of fallback
|
||||
directory mirrors. This schedule is advanced by (potentially concurrent)
|
||||
connection attempts, unlike other schedules, which are advanced by
|
||||
connection failures. (Default: 6, 11, 3600, 10800, 25200, 54000, 111600,
|
||||
262800)
|
||||
connection failures. (Default: 6)
|
||||
|
||||
[[ClientBootstrapConsensusFallbackDownloadSchedule]] **ClientBootstrapConsensusFallbackDownloadSchedule** __N__,__N__,__...__::
|
||||
Schedule for when clients should download consensuses from fallback
|
||||
[[ClientBootstrapConsensusFallbackDownloadInitialDelay]] **ClientBootstrapConsensusFallbackDownloadInitialDelay** __N__::
|
||||
Initial delay in seconds for when clients should download consensuses from fallback
|
||||
directory mirrors if they are bootstrapping (that is, they don't have a
|
||||
usable, reasonably live consensus). Only used by clients fetching from a
|
||||
list of fallback directory mirrors. This schedule is advanced by
|
||||
(potentially concurrent) connection attempts, unlike other schedules,
|
||||
which are advanced by connection failures. (Default: 0, 1, 4, 11, 3600,
|
||||
10800, 25200, 54000, 111600, 262800)
|
||||
which are advanced by connection failures. (Default: 0)
|
||||
|
||||
[[ClientBootstrapConsensusAuthorityOnlyDownloadSchedule]] **ClientBootstrapConsensusAuthorityOnlyDownloadSchedule** __N__,__N__,__...__::
|
||||
Schedule for when clients should download consensuses from authorities
|
||||
[[ClientBootstrapConsensusAuthorityOnlyDownloadInitialDelay]] **ClientBootstrapConsensusAuthorityOnlyDownloadInitialDelay** __N__::
|
||||
Initial delay in seconds for when clients should download consensuses from authorities
|
||||
if they are bootstrapping (that is, they don't have a usable, reasonably
|
||||
live consensus). Only used by clients which don't have or won't fetch
|
||||
from a list of fallback directory mirrors. This schedule is advanced by
|
||||
(potentially concurrent) connection attempts, unlike other schedules,
|
||||
which are advanced by connection failures. (Default: 0, 3, 7, 3600,
|
||||
10800, 25200, 54000, 111600, 262800)
|
||||
which are advanced by connection failures. (Default: 0)
|
||||
|
||||
[[ClientBootstrapConsensusMaxInProgressTries]] **ClientBootstrapConsensusMaxInProgressTries** __NUM__::
|
||||
Try this many simultaneous connections to download a consensus before
|
||||
|
@ -2898,12 +2895,9 @@ The following options are used for running a testing Tor network.
|
|||
AssumeReachable 1
|
||||
AuthDirMaxServersPerAddr 0
|
||||
AuthDirMaxServersPerAuthAddr 0
|
||||
ClientBootstrapConsensusAuthorityDownloadSchedule 0, 2,
|
||||
4 (for 40 seconds), 8, 16, 32, 60
|
||||
ClientBootstrapConsensusFallbackDownloadSchedule 0, 1,
|
||||
4 (for 40 seconds), 8, 16, 32, 60
|
||||
ClientBootstrapConsensusAuthorityOnlyDownloadSchedule 0, 1,
|
||||
4 (for 40 seconds), 8, 16, 32, 60
|
||||
ClientBootstrapConsensusAuthorityDownloadInitialDelay 0
|
||||
ClientBootstrapConsensusFallbackDownloadInitialDelay 0
|
||||
ClientBootstrapConsensusAuthorityOnlyDownloadInitialDelay 0
|
||||
ClientDNSRejectInternalAddresses 0
|
||||
ClientRejectInternalAddresses 0
|
||||
CountPrivateBandwidth 1
|
||||
|
@ -2918,12 +2912,12 @@ The following options are used for running a testing Tor network.
|
|||
TestingV3AuthInitialDistDelay 20 seconds
|
||||
TestingAuthDirTimeToLearnReachability 0 minutes
|
||||
TestingEstimatedDescriptorPropagationTime 0 minutes
|
||||
TestingServerDownloadSchedule 0, 0, 0, 5, 10, 15, 20, 30, 60
|
||||
TestingClientDownloadSchedule 0, 0, 5, 10, 15, 20, 30, 60
|
||||
TestingServerConsensusDownloadSchedule 0, 0, 5, 10, 15, 20, 30, 60
|
||||
TestingClientConsensusDownloadSchedule 0, 0, 5, 10, 15, 20, 30, 60
|
||||
TestingBridgeDownloadSchedule 10, 30, 60
|
||||
TestingBridgeBootstrapDownloadSchedule 0, 0, 5, 10, 15, 20, 30, 60
|
||||
TestingServerDownloadInitialDelay 0
|
||||
TestingClientDownloadInitialDelay 0
|
||||
TestingServerConsensusDownloadInitialDelay 0
|
||||
TestingClientConsensusDownloadInitialDelay 0
|
||||
TestingBridgeDownloadInitialDelay 10
|
||||
TestingBridgeBootstrapDownloadInitialDelay 0
|
||||
TestingClientMaxIntervalWithoutRequest 5 seconds
|
||||
TestingDirConnectionMaxStall 30 seconds
|
||||
TestingEnableConnBwEvent 1
|
||||
|
@ -2962,37 +2956,31 @@ The following options are used for running a testing Tor network.
|
|||
Minimum value for the Fast flag. Overrides the ordinary minimum taken
|
||||
from the consensus when TestingTorNetwork is set. (Default: 0.)
|
||||
|
||||
[[TestingServerDownloadSchedule]] **TestingServerDownloadSchedule** __N__,__N__,__...__::
|
||||
Schedule for when servers should download things in general. Changing this
|
||||
requires that **TestingTorNetwork** is set. (Default: 0, 0, 0, 60, 60, 120,
|
||||
300, 900, 2147483647)
|
||||
[[TestingServerDownloadInitialDelay]] **TestingServerDownloadInitialDelay** __N__::
|
||||
Initial delay in seconds for when servers should download things in general. Changing this
|
||||
requires that **TestingTorNetwork** is set. (Default: 0)
|
||||
|
||||
[[TestingClientDownloadSchedule]] **TestingClientDownloadSchedule** __N__,__N__,__...__::
|
||||
Schedule for when clients should download things in general. Changing this
|
||||
requires that **TestingTorNetwork** is set. (Default: 0, 0, 60, 300, 600,
|
||||
2147483647)
|
||||
[[TestingClientDownloadInitialDelay]] **TestingClientDownloadInitialDelay** __N__::
|
||||
Initial delay in seconds for when clients should download things in general. Changing this
|
||||
requires that **TestingTorNetwork** is set. (Default: 0)
|
||||
|
||||
[[TestingServerConsensusDownloadSchedule]] **TestingServerConsensusDownloadSchedule** __N__,__N__,__...__::
|
||||
Schedule for when servers should download consensuses. Changing this
|
||||
requires that **TestingTorNetwork** is set. (Default: 0, 0, 60, 300, 600,
|
||||
1800, 1800, 1800, 1800, 1800, 3600, 7200)
|
||||
[[TestingServerConsensusDownloadInitialDelay]] **TestingServerConsensusDownloadInitialDelay** __N__::
|
||||
Initial delay in seconds for when servers should download consensuses. Changing this
|
||||
requires that **TestingTorNetwork** is set. (Default: 0)
|
||||
|
||||
[[TestingClientConsensusDownloadSchedule]] **TestingClientConsensusDownloadSchedule** __N__,__N__,__...__::
|
||||
Schedule for when clients should download consensuses. Changing this
|
||||
requires that **TestingTorNetwork** is set. (Default: 0, 0, 60, 300, 600,
|
||||
1800, 3600, 3600, 3600, 10800, 21600, 43200)
|
||||
[[TestingClientConsensusDownloadInitialDelay]] **TestingClientConsensusDownloadInitialDelay** __N__::
|
||||
Initial delay in seconds for when clients should download consensuses. Changing this
|
||||
requires that **TestingTorNetwork** is set. (Default: 0)
|
||||
|
||||
[[TestingBridgeDownloadSchedule]] **TestingBridgeDownloadSchedule** __N__,__N__,__...__::
|
||||
Schedule for when clients should download each bridge descriptor when they
|
||||
[[TestingBridgeDownloadInitialDelay]] **TestingBridgeDownloadInitialDelay** __N__::
|
||||
Initial delay in seconds for when clients should download each bridge descriptor when they
|
||||
know that one or more of their configured bridges are running. Changing
|
||||
this requires that **TestingTorNetwork** is set. (Default: 10800, 25200,
|
||||
54000, 111600, 262800)
|
||||
this requires that **TestingTorNetwork** is set. (Default: 10800)
|
||||
|
||||
[[TestingBridgeBootstrapDownloadSchedule]] **TestingBridgeBootstrapDownloadSchedule** __N__,__N__,__...__::
|
||||
Schedule for when clients should download each bridge descriptor when they
|
||||
[[TestingBridgeBootstrapDownloadInitialDelay]] **TestingBridgeBootstrapDownloadInitialDelay** __N__::
|
||||
Initial delay in seconds for when clients should download each bridge descriptor when they
|
||||
have just started, or when they can not contact any of their bridges.
|
||||
Changing this requires that **TestingTorNetwork** is set. (Default: 0, 30,
|
||||
90, 600, 3600, 10800, 25200, 54000, 111600, 262800)
|
||||
Changing this requires that **TestingTorNetwork** is set. (Default: 0)
|
||||
|
||||
[[TestingClientMaxIntervalWithoutRequest]] **TestingClientMaxIntervalWithoutRequest** __N__ **seconds**|**minutes**::
|
||||
When directory clients have only a few descriptors to request, they batch
|
||||
|
|
|
@ -126,6 +126,11 @@ static const char unix_socket_prefix[] = "unix:";
|
|||
* configuration. */
|
||||
static const char unix_q_socket_prefix[] = "unix:\"";
|
||||
|
||||
/** macro to help with the bulk rename of *DownloadSchedule to
|
||||
* *DowloadInitialDelay . */
|
||||
#define DOWNLOAD_SCHEDULE(name) \
|
||||
{ #name "DownloadSchedule", #name "DownloadInitialDelay", 0, 1 }
|
||||
|
||||
/** A list of abbreviations and aliases to map command-line options, obsolete
|
||||
* option names, or alternative option names, to their current values. */
|
||||
static config_abbrev_t option_abbrevs_[] = {
|
||||
|
@ -175,6 +180,16 @@ static config_abbrev_t option_abbrevs_[] = {
|
|||
{ "_HSLayer2Nodes", "HSLayer2Nodes", 0, 1 },
|
||||
{ "_HSLayer3Nodes", "HSLayer3Nodes", 0, 1 },
|
||||
|
||||
DOWNLOAD_SCHEDULE(ClientBootstrapConsensusAuthority),
|
||||
DOWNLOAD_SCHEDULE(ClientBootstrapConsensusAuthorityOnly),
|
||||
DOWNLOAD_SCHEDULE(ClientBootstrapConsensusFallback),
|
||||
DOWNLOAD_SCHEDULE(TestingBridge),
|
||||
DOWNLOAD_SCHEDULE(TestingBridgeBootstrap),
|
||||
DOWNLOAD_SCHEDULE(TestingClient),
|
||||
DOWNLOAD_SCHEDULE(TestingClientConsensus),
|
||||
DOWNLOAD_SCHEDULE(TestingServer),
|
||||
DOWNLOAD_SCHEDULE(TestingServerConsensus),
|
||||
|
||||
{ NULL, NULL, 0, 0},
|
||||
};
|
||||
|
||||
|
@ -600,16 +615,10 @@ static config_var_t option_vars_[] = {
|
|||
VAR("__OwningControllerProcess",STRING,OwningControllerProcess, NULL),
|
||||
VAR("__OwningControllerFD",INT,OwningControllerFD, "-1"),
|
||||
V(MinUptimeHidServDirectoryV2, INTERVAL, "96 hours"),
|
||||
V(TestingServerDownloadSchedule, CSV_INTERVAL, "0, 0, 0, 60, 60, 120, "
|
||||
"300, 900, 2147483647"),
|
||||
V(TestingClientDownloadSchedule, CSV_INTERVAL, "0, 0, 60, 300, 600, "
|
||||
"2147483647"),
|
||||
V(TestingServerConsensusDownloadSchedule, CSV_INTERVAL, "0, 0, 60, "
|
||||
"300, 600, 1800, 1800, 1800, 1800, "
|
||||
"1800, 3600, 7200"),
|
||||
V(TestingClientConsensusDownloadSchedule, CSV_INTERVAL, "0, 0, 60, "
|
||||
"300, 600, 1800, 3600, 3600, 3600, "
|
||||
"10800, 21600, 43200"),
|
||||
V(TestingServerDownloadInitialDelay, CSV_INTERVAL, "0"),
|
||||
V(TestingClientDownloadInitialDelay, CSV_INTERVAL, "0"),
|
||||
V(TestingServerConsensusDownloadInitialDelay, CSV_INTERVAL, "0"),
|
||||
V(TestingClientConsensusDownloadInitialDelay, CSV_INTERVAL, "0"),
|
||||
/* With the ClientBootstrapConsensus*Download* below:
|
||||
* Clients with only authorities will try:
|
||||
* - at least 3 authorities over 10 seconds, then exponentially backoff,
|
||||
|
@ -625,13 +634,11 @@ static config_var_t option_vars_[] = {
|
|||
*
|
||||
* When clients have authorities and fallbacks available, they use these
|
||||
* schedules: (we stagger the times to avoid thundering herds) */
|
||||
V(ClientBootstrapConsensusAuthorityDownloadSchedule, CSV_INTERVAL,
|
||||
"6, 11, 3600, 10800, 25200, 54000, 111600, 262800" /* 3 days + 1 hour */),
|
||||
V(ClientBootstrapConsensusFallbackDownloadSchedule, CSV_INTERVAL,
|
||||
"0, 1, 4, 11, 3600, 10800, 25200, 54000, 111600, 262800"),
|
||||
V(ClientBootstrapConsensusAuthorityDownloadInitialDelay, CSV_INTERVAL, "6"),
|
||||
V(ClientBootstrapConsensusFallbackDownloadInitialDelay, CSV_INTERVAL, "0"),
|
||||
/* When clients only have authorities available, they use this schedule: */
|
||||
V(ClientBootstrapConsensusAuthorityOnlyDownloadSchedule, CSV_INTERVAL,
|
||||
"0, 3, 7, 3600, 10800, 25200, 54000, 111600, 262800"),
|
||||
V(ClientBootstrapConsensusAuthorityOnlyDownloadInitialDelay, CSV_INTERVAL,
|
||||
"0"),
|
||||
/* We don't want to overwhelm slow networks (or mirrors whose replies are
|
||||
* blocked), but we also don't want to fail if only some mirrors are
|
||||
* blackholed. Clients will try 3 directories simultaneously.
|
||||
|
@ -639,14 +646,12 @@ static config_var_t option_vars_[] = {
|
|||
V(ClientBootstrapConsensusMaxInProgressTries, UINT, "3"),
|
||||
/* When a client has any running bridges, check each bridge occasionally,
|
||||
* whether or not that bridge is actually up. */
|
||||
V(TestingBridgeDownloadSchedule, CSV_INTERVAL,
|
||||
"10800, 25200, 54000, 111600, 262800"),
|
||||
V(TestingBridgeDownloadInitialDelay, CSV_INTERVAL,"10800"),
|
||||
/* When a client is just starting, or has no running bridges, check each
|
||||
* bridge a few times quickly, and then try again later. These schedules
|
||||
* are much longer than the other schedules, because we try each and every
|
||||
* configured bridge with this schedule. */
|
||||
V(TestingBridgeBootstrapDownloadSchedule, CSV_INTERVAL,
|
||||
"0, 30, 90, 600, 3600, 10800, 25200, 54000, 111600, 262800"),
|
||||
V(TestingBridgeBootstrapDownloadInitialDelay, CSV_INTERVAL, "0"),
|
||||
V(TestingClientMaxIntervalWithoutRequest, INTERVAL, "10 minutes"),
|
||||
V(TestingDirConnectionMaxStall, INTERVAL, "5 minutes"),
|
||||
OBSOLETE("TestingConsensusMaxDownloadTries"),
|
||||
|
@ -673,12 +678,10 @@ static const config_var_t testing_tor_network_defaults[] = {
|
|||
V(EnforceDistinctSubnets, BOOL, "0"),
|
||||
V(AssumeReachable, BOOL, "1"),
|
||||
V(AuthDirMaxServersPerAddr, UINT, "0"),
|
||||
V(ClientBootstrapConsensusAuthorityDownloadSchedule, CSV_INTERVAL,
|
||||
"0, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 16, 32, 60"),
|
||||
V(ClientBootstrapConsensusFallbackDownloadSchedule, CSV_INTERVAL,
|
||||
"0, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 16, 32, 60"),
|
||||
V(ClientBootstrapConsensusAuthorityOnlyDownloadSchedule, CSV_INTERVAL,
|
||||
"0, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 16, 32, 60"),
|
||||
V(ClientBootstrapConsensusAuthorityDownloadInitialDelay, CSV_INTERVAL, "0"),
|
||||
V(ClientBootstrapConsensusFallbackDownloadInitialDelay, CSV_INTERVAL, "0"),
|
||||
V(ClientBootstrapConsensusAuthorityOnlyDownloadInitialDelay, CSV_INTERVAL,
|
||||
"0"),
|
||||
V(ClientDNSRejectInternalAddresses, BOOL,"0"),
|
||||
V(ClientRejectInternalAddresses, BOOL, "0"),
|
||||
V(CountPrivateBandwidth, BOOL, "1"),
|
||||
|
@ -693,17 +696,12 @@ static const config_var_t testing_tor_network_defaults[] = {
|
|||
V(TestingAuthDirTimeToLearnReachability, INTERVAL, "0 minutes"),
|
||||
V(TestingEstimatedDescriptorPropagationTime, INTERVAL, "0 minutes"),
|
||||
V(MinUptimeHidServDirectoryV2, INTERVAL, "0 minutes"),
|
||||
V(TestingServerDownloadSchedule, CSV_INTERVAL, "0, 0, 0, 5, 10, 15, "
|
||||
"20, 30, 60"),
|
||||
V(TestingClientDownloadSchedule, CSV_INTERVAL, "0, 0, 5, 10, 15, 20, "
|
||||
"30, 60"),
|
||||
V(TestingServerConsensusDownloadSchedule, CSV_INTERVAL, "0, 0, 5, 10, "
|
||||
"15, 20, 30, 60"),
|
||||
V(TestingClientConsensusDownloadSchedule, CSV_INTERVAL, "0, 0, 5, 10, "
|
||||
"15, 20, 30, 60"),
|
||||
V(TestingBridgeDownloadSchedule, CSV_INTERVAL, "10, 30, 60"),
|
||||
V(TestingBridgeBootstrapDownloadSchedule, CSV_INTERVAL, "0, 0, 5, 10, "
|
||||
"15, 20, 30, 60"),
|
||||
V(TestingServerDownloadInitialDelay, CSV_INTERVAL, "0"),
|
||||
V(TestingClientDownloadInitialDelay, CSV_INTERVAL, "0"),
|
||||
V(TestingServerConsensusDownloadInitialDelay, CSV_INTERVAL, "0"),
|
||||
V(TestingClientConsensusDownloadInitialDelay, CSV_INTERVAL, "0"),
|
||||
V(TestingBridgeDownloadInitialDelay, CSV_INTERVAL, "10"),
|
||||
V(TestingBridgeBootstrapDownloadInitialDelay, CSV_INTERVAL, "0"),
|
||||
V(TestingClientMaxIntervalWithoutRequest, INTERVAL, "5 seconds"),
|
||||
V(TestingDirConnectionMaxStall, INTERVAL, "30 seconds"),
|
||||
V(TestingEnableConnBwEvent, BOOL, "1"),
|
||||
|
@ -4379,12 +4377,12 @@ options_validate(or_options_t *old_options, or_options_t *options,
|
|||
CHECK_DEFAULT(TestingV3AuthVotingStartOffset);
|
||||
CHECK_DEFAULT(TestingAuthDirTimeToLearnReachability);
|
||||
CHECK_DEFAULT(TestingEstimatedDescriptorPropagationTime);
|
||||
CHECK_DEFAULT(TestingServerDownloadSchedule);
|
||||
CHECK_DEFAULT(TestingClientDownloadSchedule);
|
||||
CHECK_DEFAULT(TestingServerConsensusDownloadSchedule);
|
||||
CHECK_DEFAULT(TestingClientConsensusDownloadSchedule);
|
||||
CHECK_DEFAULT(TestingBridgeDownloadSchedule);
|
||||
CHECK_DEFAULT(TestingBridgeBootstrapDownloadSchedule);
|
||||
CHECK_DEFAULT(TestingServerDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingClientDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingServerConsensusDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingClientConsensusDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingBridgeDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingBridgeBootstrapDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingClientMaxIntervalWithoutRequest);
|
||||
CHECK_DEFAULT(TestingDirConnectionMaxStall);
|
||||
CHECK_DEFAULT(TestingAuthKeyLifetime);
|
||||
|
|
|
@ -162,8 +162,6 @@ config_assign_value(const config_format_t *fmt, void *options,
|
|||
int i, ok;
|
||||
const config_var_t *var;
|
||||
void *lvalue;
|
||||
int *csv_int;
|
||||
smartlist_t *csv_str;
|
||||
|
||||
CONFIG_CHECK(fmt, options);
|
||||
|
||||
|
@ -195,6 +193,30 @@ config_assign_value(const config_format_t *fmt, void *options,
|
|||
*(int *)lvalue = i;
|
||||
break;
|
||||
|
||||
case CONFIG_TYPE_CSV_INTERVAL: {
|
||||
/* We used to have entire smartlists here. But now that all of our
|
||||
* download schedules use exponential backoff, only the first part
|
||||
* matters. */
|
||||
const char *comma = strchr(c->value, ',');
|
||||
const char *val = c->value;
|
||||
char *tmp = NULL;
|
||||
if (comma) {
|
||||
tmp = tor_strndup(c->value, comma - c->value);
|
||||
val = tmp;
|
||||
}
|
||||
|
||||
i = config_parse_interval(val, &ok);
|
||||
if (!ok) {
|
||||
tor_asprintf(msg,
|
||||
"Interval '%s %s' is malformed or out of bounds.",
|
||||
c->key, c->value);
|
||||
return -1;
|
||||
}
|
||||
*(int *)lvalue = i;
|
||||
tor_free(tmp);
|
||||
break;
|
||||
}
|
||||
|
||||
case CONFIG_TYPE_INTERVAL: {
|
||||
i = config_parse_interval(c->value, &ok);
|
||||
if (!ok) {
|
||||
|
@ -298,36 +320,6 @@ config_assign_value(const config_format_t *fmt, void *options,
|
|||
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
|
||||
break;
|
||||
|
||||
case CONFIG_TYPE_CSV_INTERVAL:
|
||||
if (*(smartlist_t**)lvalue) {
|
||||
SMARTLIST_FOREACH(*(smartlist_t**)lvalue, int *, cp, tor_free(cp));
|
||||
smartlist_clear(*(smartlist_t**)lvalue);
|
||||
} else {
|
||||
*(smartlist_t**)lvalue = smartlist_new();
|
||||
}
|
||||
csv_str = smartlist_new();
|
||||
smartlist_split_string(csv_str, c->value, ",",
|
||||
SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
|
||||
SMARTLIST_FOREACH_BEGIN(csv_str, char *, str)
|
||||
{
|
||||
i = config_parse_interval(str, &ok);
|
||||
if (!ok) {
|
||||
tor_asprintf(msg,
|
||||
"Interval in '%s %s' is malformed or out of bounds.",
|
||||
c->key, c->value);
|
||||
SMARTLIST_FOREACH(csv_str, char *, cp, tor_free(cp));
|
||||
smartlist_free(csv_str);
|
||||
return -1;
|
||||
}
|
||||
csv_int = tor_malloc_zero(sizeof(int));
|
||||
*csv_int = i;
|
||||
smartlist_add(*(smartlist_t**)lvalue, csv_int);
|
||||
}
|
||||
SMARTLIST_FOREACH_END(str);
|
||||
SMARTLIST_FOREACH(csv_str, char *, cp, tor_free(cp));
|
||||
smartlist_free(csv_str);
|
||||
break;
|
||||
|
||||
case CONFIG_TYPE_LINELIST:
|
||||
case CONFIG_TYPE_LINELIST_S:
|
||||
{
|
||||
|
@ -528,7 +520,6 @@ config_get_assigned_option(const config_format_t *fmt, const void *options,
|
|||
const config_var_t *var;
|
||||
const void *value;
|
||||
config_line_t *result;
|
||||
smartlist_t *csv_str;
|
||||
tor_assert(options && key);
|
||||
|
||||
CONFIG_CHECK(fmt, options);
|
||||
|
@ -571,6 +562,7 @@ config_get_assigned_option(const config_format_t *fmt, const void *options,
|
|||
break;
|
||||
}
|
||||
/* fall through */
|
||||
case CONFIG_TYPE_CSV_INTERVAL:
|
||||
case CONFIG_TYPE_INTERVAL:
|
||||
case CONFIG_TYPE_MSEC_INTERVAL:
|
||||
case CONFIG_TYPE_UINT:
|
||||
|
@ -611,20 +603,6 @@ config_get_assigned_option(const config_format_t *fmt, const void *options,
|
|||
else
|
||||
result->value = tor_strdup("");
|
||||
break;
|
||||
case CONFIG_TYPE_CSV_INTERVAL:
|
||||
if (*(smartlist_t**)value) {
|
||||
csv_str = smartlist_new();
|
||||
SMARTLIST_FOREACH_BEGIN(*(smartlist_t**)value, int *, i)
|
||||
{
|
||||
smartlist_add_asprintf(csv_str, "%d", *i);
|
||||
}
|
||||
SMARTLIST_FOREACH_END(i);
|
||||
result->value = smartlist_join_strings(csv_str, ",", 0, NULL);
|
||||
SMARTLIST_FOREACH(csv_str, char *, cp, tor_free(cp));
|
||||
smartlist_free(csv_str);
|
||||
} else
|
||||
result->value = tor_strdup("");
|
||||
break;
|
||||
case CONFIG_TYPE_OBSOLETE:
|
||||
log_fn(LOG_INFO, LD_CONFIG,
|
||||
"You asked me for the value of an obsolete config option '%s'.",
|
||||
|
@ -789,6 +767,7 @@ config_clear(const config_format_t *fmt, void *options,
|
|||
case CONFIG_TYPE_ISOTIME:
|
||||
*(time_t*)lvalue = 0;
|
||||
break;
|
||||
case CONFIG_TYPE_CSV_INTERVAL:
|
||||
case CONFIG_TYPE_INTERVAL:
|
||||
case CONFIG_TYPE_MSEC_INTERVAL:
|
||||
case CONFIG_TYPE_UINT:
|
||||
|
@ -816,13 +795,6 @@ config_clear(const config_format_t *fmt, void *options,
|
|||
*(smartlist_t **)lvalue = NULL;
|
||||
}
|
||||
break;
|
||||
case CONFIG_TYPE_CSV_INTERVAL:
|
||||
if (*(smartlist_t**)lvalue) {
|
||||
SMARTLIST_FOREACH(*(smartlist_t **)lvalue, int *, cp, tor_free(cp));
|
||||
smartlist_free(*(smartlist_t **)lvalue);
|
||||
*(smartlist_t **)lvalue = NULL;
|
||||
}
|
||||
break;
|
||||
case CONFIG_TYPE_LINELIST:
|
||||
case CONFIG_TYPE_LINELIST_S:
|
||||
config_free_lines(*(config_line_t **)lvalue);
|
||||
|
|
|
@ -28,7 +28,9 @@ typedef enum config_type_t {
|
|||
* optional whitespace. */
|
||||
CONFIG_TYPE_CSV_INTERVAL, /**< A list of strings, separated by commas and
|
||||
* optional whitespace, representing intervals in
|
||||
* seconds, with optional units */
|
||||
* seconds, with optional units. We allow
|
||||
* multiple values here for legacy reasons, but
|
||||
* ignore every value after the first. */
|
||||
CONFIG_TYPE_LINELIST, /**< Uninterpreted config lines */
|
||||
CONFIG_TYPE_LINELIST_S, /**< Uninterpreted, context-sensitive config lines,
|
||||
* mixed with other keywords. */
|
||||
|
@ -62,7 +64,7 @@ typedef union {
|
|||
int *AUTOBOOL;
|
||||
time_t *ISOTIME;
|
||||
smartlist_t **CSV;
|
||||
smartlist_t **CSV_INTERVAL;
|
||||
int *CSV_INTERVAL;
|
||||
config_line_t **LINELIST;
|
||||
config_line_t **LINELIST_S;
|
||||
config_line_t **LINELIST_V;
|
||||
|
|
|
@ -5300,84 +5300,71 @@ connection_dir_finished_connecting(dir_connection_t *conn)
|
|||
|
||||
/** Decide which download schedule we want to use based on descriptor type
|
||||
* in <b>dls</b> and <b>options</b>.
|
||||
* Then return a list of int pointers defining download delays in seconds.
|
||||
*
|
||||
* Then, return the initial delay for that download schedule, in seconds.
|
||||
*
|
||||
* Helper function for download_status_increment_failure(),
|
||||
* download_status_reset(), and download_status_increment_attempt(). */
|
||||
STATIC const smartlist_t *
|
||||
find_dl_schedule(const download_status_t *dls, const or_options_t *options)
|
||||
STATIC int
|
||||
find_dl_min_delay(const download_status_t *dls, const or_options_t *options)
|
||||
{
|
||||
tor_assert(dls);
|
||||
tor_assert(options);
|
||||
|
||||
switch (dls->schedule) {
|
||||
case DL_SCHED_GENERIC:
|
||||
/* Any other directory document */
|
||||
if (dir_server_mode(options)) {
|
||||
/* A directory authority or directory mirror */
|
||||
return options->TestingServerDownloadSchedule;
|
||||
return options->TestingServerDownloadInitialDelay;
|
||||
} else {
|
||||
return options->TestingClientDownloadSchedule;
|
||||
return options->TestingClientDownloadInitialDelay;
|
||||
}
|
||||
case DL_SCHED_CONSENSUS:
|
||||
if (!networkstatus_consensus_can_use_multiple_directories(options)) {
|
||||
/* A public relay */
|
||||
return options->TestingServerConsensusDownloadSchedule;
|
||||
return options->TestingServerConsensusDownloadInitialDelay;
|
||||
} else {
|
||||
/* A client or bridge */
|
||||
if (networkstatus_consensus_is_bootstrapping(time(NULL))) {
|
||||
/* During bootstrapping */
|
||||
if (!networkstatus_consensus_can_use_extra_fallbacks(options)) {
|
||||
/* A bootstrapping client without extra fallback directories */
|
||||
return
|
||||
options->ClientBootstrapConsensusAuthorityOnlyDownloadSchedule;
|
||||
return options->
|
||||
ClientBootstrapConsensusAuthorityOnlyDownloadInitialDelay;
|
||||
} else if (dls->want_authority) {
|
||||
/* A bootstrapping client with extra fallback directories, but
|
||||
* connecting to an authority */
|
||||
return
|
||||
options->ClientBootstrapConsensusAuthorityDownloadSchedule;
|
||||
options->ClientBootstrapConsensusAuthorityDownloadInitialDelay;
|
||||
} else {
|
||||
/* A bootstrapping client connecting to extra fallback directories
|
||||
*/
|
||||
return
|
||||
options->ClientBootstrapConsensusFallbackDownloadSchedule;
|
||||
options->ClientBootstrapConsensusFallbackDownloadInitialDelay;
|
||||
}
|
||||
} else {
|
||||
/* A client with a reasonably live consensus, with or without
|
||||
* certificates */
|
||||
return options->TestingClientConsensusDownloadSchedule;
|
||||
return options->TestingClientConsensusDownloadInitialDelay;
|
||||
}
|
||||
}
|
||||
case DL_SCHED_BRIDGE:
|
||||
if (options->UseBridges && num_bridges_usable(0) > 0) {
|
||||
/* A bridge client that is sure that one or more of its bridges are
|
||||
* running can afford to wait longer to update bridge descriptors. */
|
||||
return options->TestingBridgeDownloadSchedule;
|
||||
return options->TestingBridgeDownloadInitialDelay;
|
||||
} else {
|
||||
/* A bridge client which might have no running bridges, must try to
|
||||
* get bridge descriptors straight away. */
|
||||
return options->TestingBridgeBootstrapDownloadSchedule;
|
||||
return options->TestingBridgeBootstrapDownloadInitialDelay;
|
||||
}
|
||||
default:
|
||||
tor_assert(0);
|
||||
}
|
||||
|
||||
/* Impossible, but gcc will fail with -Werror without a `return`. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Decide which minimum delay step we want to use based on
|
||||
* descriptor type in <b>dls</b> and <b>options</b>.
|
||||
* Helper function for download_status_schedule_get_delay(). */
|
||||
STATIC int
|
||||
find_dl_min_delay(download_status_t *dls, const or_options_t *options)
|
||||
{
|
||||
tor_assert(dls);
|
||||
tor_assert(options);
|
||||
|
||||
/*
|
||||
* For now, just use the existing schedule config stuff and pick the
|
||||
* first/last entries off to get min/max delay for backoff purposes
|
||||
*/
|
||||
const smartlist_t *schedule = find_dl_schedule(dls, options);
|
||||
tor_assert(schedule != NULL && smartlist_len(schedule) >= 2);
|
||||
return *(int *)(smartlist_get(schedule, 0));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** As next_random_exponential_delay() below, but does not compute a random
|
||||
|
@ -5634,10 +5621,9 @@ download_status_increment_attempt(download_status_t *dls, const char *item,
|
|||
static time_t
|
||||
download_status_get_initial_delay_from_now(const download_status_t *dls)
|
||||
{
|
||||
const smartlist_t *schedule = find_dl_schedule(dls, get_options());
|
||||
/* We use constant initial delays, even in exponential backoff
|
||||
* schedules. */
|
||||
return time(NULL) + *(int *)smartlist_get(schedule, 0);
|
||||
return time(NULL) + find_dl_min_delay(dls, get_options());
|
||||
}
|
||||
|
||||
/** Reset <b>dls</b> so that it will be considered downloadable
|
||||
|
|
|
@ -259,9 +259,7 @@ STATIC char* authdir_type_to_string(dirinfo_type_t auth);
|
|||
STATIC const char * dir_conn_purpose_to_string(int purpose);
|
||||
STATIC int should_use_directory_guards(const or_options_t *options);
|
||||
STATIC compression_level_t choose_compression_level(ssize_t n_bytes);
|
||||
STATIC const smartlist_t *find_dl_schedule(const download_status_t *dls,
|
||||
const or_options_t *options);
|
||||
STATIC int find_dl_min_delay(download_status_t *dls,
|
||||
STATIC int find_dl_min_delay(const download_status_t *dls,
|
||||
const or_options_t *options);
|
||||
|
||||
STATIC int next_random_exponential_delay(int delay,
|
||||
|
|
18
src/or/or.h
18
src/or/or.h
|
@ -4318,19 +4318,19 @@ typedef struct {
|
|||
|
||||
/** Schedule for when servers should download things in general. Only
|
||||
* altered on testing networks. */
|
||||
smartlist_t *TestingServerDownloadSchedule;
|
||||
int TestingServerDownloadInitialDelay;
|
||||
|
||||
/** Schedule for when clients should download things in general. Only
|
||||
* altered on testing networks. */
|
||||
smartlist_t *TestingClientDownloadSchedule;
|
||||
int TestingClientDownloadInitialDelay;
|
||||
|
||||
/** Schedule for when servers should download consensuses. Only altered
|
||||
* on testing networks. */
|
||||
smartlist_t *TestingServerConsensusDownloadSchedule;
|
||||
int TestingServerConsensusDownloadInitialDelay;
|
||||
|
||||
/** Schedule for when clients should download consensuses. Only altered
|
||||
* on testing networks. */
|
||||
smartlist_t *TestingClientConsensusDownloadSchedule;
|
||||
int TestingClientConsensusDownloadInitialDelay;
|
||||
|
||||
/** Schedule for when clients should download consensuses from authorities
|
||||
* if they are bootstrapping (that is, they don't have a usable, reasonably
|
||||
|
@ -4340,7 +4340,7 @@ typedef struct {
|
|||
* This schedule is incremented by (potentially concurrent) connection
|
||||
* attempts, unlike other schedules, which are incremented by connection
|
||||
* failures. Only altered on testing networks. */
|
||||
smartlist_t *ClientBootstrapConsensusAuthorityDownloadSchedule;
|
||||
int ClientBootstrapConsensusAuthorityDownloadInitialDelay;
|
||||
|
||||
/** Schedule for when clients should download consensuses from fallback
|
||||
* directory mirrors if they are bootstrapping (that is, they don't have a
|
||||
|
@ -4350,7 +4350,7 @@ typedef struct {
|
|||
* This schedule is incremented by (potentially concurrent) connection
|
||||
* attempts, unlike other schedules, which are incremented by connection
|
||||
* failures. Only altered on testing networks. */
|
||||
smartlist_t *ClientBootstrapConsensusFallbackDownloadSchedule;
|
||||
int ClientBootstrapConsensusFallbackDownloadInitialDelay;
|
||||
|
||||
/** Schedule for when clients should download consensuses from authorities
|
||||
* if they are bootstrapping (that is, they don't have a usable, reasonably
|
||||
|
@ -4360,15 +4360,15 @@ typedef struct {
|
|||
* This schedule is incremented by (potentially concurrent) connection
|
||||
* attempts, unlike other schedules, which are incremented by connection
|
||||
* failures. Only altered on testing networks. */
|
||||
smartlist_t *ClientBootstrapConsensusAuthorityOnlyDownloadSchedule;
|
||||
int ClientBootstrapConsensusAuthorityOnlyDownloadInitialDelay;
|
||||
|
||||
/** Schedule for when clients should download bridge descriptors. Only
|
||||
* altered on testing networks. */
|
||||
smartlist_t *TestingBridgeDownloadSchedule;
|
||||
int TestingBridgeDownloadInitialDelay;
|
||||
|
||||
/** Schedule for when clients should download bridge descriptors when they
|
||||
* have no running bridges. Only altered on testing networks. */
|
||||
smartlist_t *TestingBridgeBootstrapDownloadSchedule;
|
||||
int TestingBridgeBootstrapDownloadInitialDelay;
|
||||
|
||||
/** When directory clients have only a few descriptors to request, they
|
||||
* batch them until they have more, or until this amount of time has
|
||||
|
|
|
@ -4065,34 +4065,19 @@ test_dir_download_status_increment(void *arg)
|
|||
DL_WANT_ANY_DIRSERVER,
|
||||
DL_SCHED_INCREMENT_ATTEMPT,
|
||||
0, 0 };
|
||||
int no_delay = 0;
|
||||
int delay0 = -1;
|
||||
int delay1 = -1;
|
||||
int delay2 = -1;
|
||||
smartlist_t *schedule = smartlist_new();
|
||||
smartlist_t *schedule_no_initial_delay = smartlist_new();
|
||||
or_options_t test_options;
|
||||
time_t current_time = time(NULL);
|
||||
|
||||
/* Provide some values for the schedules */
|
||||
delay0 = 10;
|
||||
delay1 = 99;
|
||||
delay2 = 20;
|
||||
|
||||
/* Make the schedules */
|
||||
smartlist_add(schedule, (void *)&delay0);
|
||||
smartlist_add(schedule, (void *)&delay1);
|
||||
smartlist_add(schedule, (void *)&delay2);
|
||||
|
||||
smartlist_add(schedule_no_initial_delay, (void *)&no_delay);
|
||||
smartlist_add(schedule_no_initial_delay, (void *)&delay1);
|
||||
smartlist_add(schedule_no_initial_delay, (void *)&delay2);
|
||||
const int delay0 = 10;
|
||||
const int no_delay = 0;
|
||||
const int schedule = 10;
|
||||
const int schedule_no_initial_delay = 0;
|
||||
|
||||
/* Put it in the options */
|
||||
mock_options = &test_options;
|
||||
reset_options(mock_options, &mock_get_options_calls);
|
||||
mock_options->TestingBridgeBootstrapDownloadSchedule = schedule;
|
||||
mock_options->TestingClientDownloadSchedule = schedule;
|
||||
mock_options->TestingBridgeBootstrapDownloadInitialDelay = schedule;
|
||||
mock_options->TestingClientDownloadInitialDelay = schedule;
|
||||
|
||||
MOCK(get_options, mock_get_options);
|
||||
|
||||
|
@ -4100,13 +4085,13 @@ test_dir_download_status_increment(void *arg)
|
|||
* whether or not it was reset before being used */
|
||||
|
||||
/* regression test for 17750: no initial delay */
|
||||
mock_options->TestingClientDownloadSchedule = schedule_no_initial_delay;
|
||||
mock_options->TestingClientDownloadInitialDelay = schedule_no_initial_delay;
|
||||
mock_get_options_calls = 0;
|
||||
/* we really want to test that it's equal to time(NULL) + delay0, but that's
|
||||
* an unrealiable test, because time(NULL) might change. */
|
||||
|
||||
/* regression test for 17750: exponential, no initial delay */
|
||||
mock_options->TestingClientDownloadSchedule = schedule_no_initial_delay;
|
||||
mock_options->TestingClientDownloadInitialDelay = schedule_no_initial_delay;
|
||||
mock_get_options_calls = 0;
|
||||
/* we really want to test that it's equal to time(NULL) + delay0, but that's
|
||||
* an unrealiable test, because time(NULL) might change. */
|
||||
|
@ -4119,7 +4104,7 @@ test_dir_download_status_increment(void *arg)
|
|||
tt_int_op(mock_get_options_calls, OP_GE, 1);
|
||||
|
||||
/* regression test for 17750: exponential, initial delay */
|
||||
mock_options->TestingClientDownloadSchedule = schedule;
|
||||
mock_options->TestingClientDownloadInitialDelay = schedule;
|
||||
mock_get_options_calls = 0;
|
||||
/* we really want to test that it's equal to time(NULL) + delay0, but that's
|
||||
* an unrealiable test, because time(NULL) might change. */
|
||||
|
@ -4132,9 +4117,6 @@ test_dir_download_status_increment(void *arg)
|
|||
tt_int_op(mock_get_options_calls, OP_GE, 1);
|
||||
|
||||
done:
|
||||
/* the pointers in schedule are allocated on the stack */
|
||||
smartlist_free(schedule);
|
||||
smartlist_free(schedule_no_initial_delay);
|
||||
UNMOCK(get_options);
|
||||
mock_options = NULL;
|
||||
mock_get_options_calls = 0;
|
||||
|
@ -5452,7 +5434,7 @@ mock_num_bridges_usable(int use_maybe_reachable)
|
|||
* fallbacks.
|
||||
*/
|
||||
static void
|
||||
test_dir_find_dl_schedule(void* data)
|
||||
test_dir_find_dl_min_delay(void* data)
|
||||
{
|
||||
const char *str = (const char *)data;
|
||||
|
||||
|
@ -5485,44 +5467,45 @@ test_dir_find_dl_schedule(void* data)
|
|||
mock_num_bridges_usable);
|
||||
|
||||
download_status_t dls;
|
||||
smartlist_t server, client, server_cons, client_cons;
|
||||
smartlist_t client_boot_auth_only_cons, client_boot_auth_cons;
|
||||
smartlist_t client_boot_fallback_cons, bridge, bridge_bootstrap;
|
||||
|
||||
const int server=10, client=20, server_cons=30, client_cons=40;
|
||||
const int client_boot_auth_only_cons=50, client_boot_auth_cons=60;
|
||||
const int client_boot_fallback_cons=70, bridge=80, bridge_bootstrap=90;
|
||||
|
||||
mock_options = tor_malloc(sizeof(or_options_t));
|
||||
reset_options(mock_options, &mock_get_options_calls);
|
||||
MOCK(get_options, mock_get_options);
|
||||
|
||||
mock_options->TestingServerDownloadSchedule = &server;
|
||||
mock_options->TestingClientDownloadSchedule = &client;
|
||||
mock_options->TestingServerConsensusDownloadSchedule = &server_cons;
|
||||
mock_options->TestingClientConsensusDownloadSchedule = &client_cons;
|
||||
mock_options->ClientBootstrapConsensusAuthorityOnlyDownloadSchedule =
|
||||
&client_boot_auth_only_cons;
|
||||
mock_options->ClientBootstrapConsensusAuthorityDownloadSchedule =
|
||||
&client_boot_auth_cons;
|
||||
mock_options->ClientBootstrapConsensusFallbackDownloadSchedule =
|
||||
&client_boot_fallback_cons;
|
||||
mock_options->TestingBridgeDownloadSchedule = &bridge;
|
||||
mock_options->TestingBridgeBootstrapDownloadSchedule = &bridge_bootstrap;
|
||||
mock_options->TestingServerDownloadInitialDelay = server;
|
||||
mock_options->TestingClientDownloadInitialDelay = client;
|
||||
mock_options->TestingServerConsensusDownloadInitialDelay = server_cons;
|
||||
mock_options->TestingClientConsensusDownloadInitialDelay = client_cons;
|
||||
mock_options->ClientBootstrapConsensusAuthorityOnlyDownloadInitialDelay =
|
||||
client_boot_auth_only_cons;
|
||||
mock_options->ClientBootstrapConsensusAuthorityDownloadInitialDelay =
|
||||
client_boot_auth_cons;
|
||||
mock_options->ClientBootstrapConsensusFallbackDownloadInitialDelay =
|
||||
client_boot_fallback_cons;
|
||||
mock_options->TestingBridgeDownloadInitialDelay = bridge;
|
||||
mock_options->TestingBridgeBootstrapDownloadInitialDelay = bridge_bootstrap;
|
||||
|
||||
dls.schedule = DL_SCHED_GENERIC;
|
||||
/* client */
|
||||
mock_options->ClientOnly = 1;
|
||||
tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ, &client);
|
||||
tt_int_op(find_dl_min_delay(&dls, mock_options), OP_EQ, client);
|
||||
mock_options->ClientOnly = 0;
|
||||
|
||||
/* dir mode */
|
||||
mock_options->DirPort_set = 1;
|
||||
mock_options->DirCache = 1;
|
||||
tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ, &server);
|
||||
tt_int_op(find_dl_min_delay(&dls, mock_options), OP_EQ, server);
|
||||
mock_options->DirPort_set = 0;
|
||||
mock_options->DirCache = 0;
|
||||
|
||||
dls.schedule = DL_SCHED_CONSENSUS;
|
||||
/* public server mode */
|
||||
mock_options->ORPort_set = 1;
|
||||
tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ, &server_cons);
|
||||
tt_int_op(find_dl_min_delay(&dls, mock_options), OP_EQ, server_cons);
|
||||
mock_options->ORPort_set = 0;
|
||||
|
||||
/* client and bridge modes */
|
||||
|
@ -5531,30 +5514,30 @@ test_dir_find_dl_schedule(void* data)
|
|||
dls.want_authority = 1;
|
||||
/* client */
|
||||
mock_options->ClientOnly = 1;
|
||||
tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ,
|
||||
&client_boot_auth_cons);
|
||||
tt_int_op(find_dl_min_delay(&dls, mock_options), OP_EQ,
|
||||
client_boot_auth_cons);
|
||||
mock_options->ClientOnly = 0;
|
||||
|
||||
/* bridge relay */
|
||||
mock_options->ORPort_set = 1;
|
||||
mock_options->BridgeRelay = 1;
|
||||
tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ,
|
||||
&client_boot_auth_cons);
|
||||
tt_int_op(find_dl_min_delay(&dls, mock_options), OP_EQ,
|
||||
client_boot_auth_cons);
|
||||
mock_options->ORPort_set = 0;
|
||||
mock_options->BridgeRelay = 0;
|
||||
|
||||
dls.want_authority = 0;
|
||||
/* client */
|
||||
mock_options->ClientOnly = 1;
|
||||
tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ,
|
||||
&client_boot_fallback_cons);
|
||||
tt_int_op(find_dl_min_delay(&dls, mock_options), OP_EQ,
|
||||
client_boot_fallback_cons);
|
||||
mock_options->ClientOnly = 0;
|
||||
|
||||
/* bridge relay */
|
||||
mock_options->ORPort_set = 1;
|
||||
mock_options->BridgeRelay = 1;
|
||||
tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ,
|
||||
&client_boot_fallback_cons);
|
||||
tt_int_op(find_dl_min_delay(&dls, mock_options), OP_EQ,
|
||||
client_boot_fallback_cons);
|
||||
mock_options->ORPort_set = 0;
|
||||
mock_options->BridgeRelay = 0;
|
||||
|
||||
|
@ -5562,30 +5545,30 @@ test_dir_find_dl_schedule(void* data)
|
|||
/* dls.want_authority is ignored */
|
||||
/* client */
|
||||
mock_options->ClientOnly = 1;
|
||||
tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ,
|
||||
&client_boot_auth_only_cons);
|
||||
tt_int_op(find_dl_min_delay(&dls, mock_options), OP_EQ,
|
||||
client_boot_auth_only_cons);
|
||||
mock_options->ClientOnly = 0;
|
||||
|
||||
/* bridge relay */
|
||||
mock_options->ORPort_set = 1;
|
||||
mock_options->BridgeRelay = 1;
|
||||
tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ,
|
||||
&client_boot_auth_only_cons);
|
||||
tt_int_op(find_dl_min_delay(&dls, mock_options), OP_EQ,
|
||||
client_boot_auth_only_cons);
|
||||
mock_options->ORPort_set = 0;
|
||||
mock_options->BridgeRelay = 0;
|
||||
}
|
||||
} else {
|
||||
/* client */
|
||||
mock_options->ClientOnly = 1;
|
||||
tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ,
|
||||
&client_cons);
|
||||
tt_int_op(find_dl_min_delay(&dls, mock_options), OP_EQ,
|
||||
client_cons);
|
||||
mock_options->ClientOnly = 0;
|
||||
|
||||
/* bridge relay */
|
||||
mock_options->ORPort_set = 1;
|
||||
mock_options->BridgeRelay = 1;
|
||||
tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ,
|
||||
&client_cons);
|
||||
tt_int_op(find_dl_min_delay(&dls, mock_options), OP_EQ,
|
||||
client_cons);
|
||||
mock_options->ORPort_set = 0;
|
||||
mock_options->BridgeRelay = 0;
|
||||
}
|
||||
|
@ -5595,9 +5578,9 @@ test_dir_find_dl_schedule(void* data)
|
|||
mock_options->ClientOnly = 1;
|
||||
mock_options->UseBridges = 1;
|
||||
if (num_bridges_usable(0) > 0) {
|
||||
tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ, &bridge);
|
||||
tt_int_op(find_dl_min_delay(&dls, mock_options), OP_EQ, bridge);
|
||||
} else {
|
||||
tt_ptr_op(find_dl_schedule(&dls, mock_options), OP_EQ, &bridge_bootstrap);
|
||||
tt_int_op(find_dl_min_delay(&dls, mock_options), OP_EQ, bridge_bootstrap);
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -5871,14 +5854,14 @@ struct testcase_t dir_tests[] = {
|
|||
DIR(dump_unparseable_descriptors, 0),
|
||||
DIR(populate_dump_desc_fifo, 0),
|
||||
DIR(populate_dump_desc_fifo_2, 0),
|
||||
DIR_ARG(find_dl_schedule, TT_FORK, "bfd"),
|
||||
DIR_ARG(find_dl_schedule, TT_FORK, "bad"),
|
||||
DIR_ARG(find_dl_schedule, TT_FORK, "cfd"),
|
||||
DIR_ARG(find_dl_schedule, TT_FORK, "cad"),
|
||||
DIR_ARG(find_dl_schedule, TT_FORK, "bfr"),
|
||||
DIR_ARG(find_dl_schedule, TT_FORK, "bar"),
|
||||
DIR_ARG(find_dl_schedule, TT_FORK, "cfr"),
|
||||
DIR_ARG(find_dl_schedule, TT_FORK, "car"),
|
||||
DIR_ARG(find_dl_min_delay, TT_FORK, "bfd"),
|
||||
DIR_ARG(find_dl_min_delay, TT_FORK, "bad"),
|
||||
DIR_ARG(find_dl_min_delay, TT_FORK, "cfd"),
|
||||
DIR_ARG(find_dl_min_delay, TT_FORK, "cad"),
|
||||
DIR_ARG(find_dl_min_delay, TT_FORK, "bfr"),
|
||||
DIR_ARG(find_dl_min_delay, TT_FORK, "bar"),
|
||||
DIR_ARG(find_dl_min_delay, TT_FORK, "cfr"),
|
||||
DIR_ARG(find_dl_min_delay, TT_FORK, "car"),
|
||||
DIR(assumed_flags, 0),
|
||||
DIR(networkstatus_compute_bw_weights_v10, 0),
|
||||
DIR(platform_str, 0),
|
||||
|
|
|
@ -2067,12 +2067,12 @@ test_options_validate__testing(void *ignored)
|
|||
ENSURE_DEFAULT(TestingV3AuthVotingStartOffset, 3000);
|
||||
ENSURE_DEFAULT(TestingAuthDirTimeToLearnReachability, 3000);
|
||||
ENSURE_DEFAULT(TestingEstimatedDescriptorPropagationTime, 3000);
|
||||
ENSURE_DEFAULT(TestingServerDownloadSchedule, 3000);
|
||||
ENSURE_DEFAULT(TestingClientDownloadSchedule, 3000);
|
||||
ENSURE_DEFAULT(TestingServerConsensusDownloadSchedule, 3000);
|
||||
ENSURE_DEFAULT(TestingClientConsensusDownloadSchedule, 3000);
|
||||
ENSURE_DEFAULT(TestingBridgeDownloadSchedule, 3000);
|
||||
ENSURE_DEFAULT(TestingBridgeBootstrapDownloadSchedule, 3000);
|
||||
ENSURE_DEFAULT(TestingServerDownloadInitialDelay, 3000);
|
||||
ENSURE_DEFAULT(TestingClientDownloadInitialDelay, 3000);
|
||||
ENSURE_DEFAULT(TestingServerConsensusDownloadInitialDelay, 3000);
|
||||
ENSURE_DEFAULT(TestingClientConsensusDownloadInitialDelay, 3000);
|
||||
ENSURE_DEFAULT(TestingBridgeDownloadInitialDelay, 3000);
|
||||
ENSURE_DEFAULT(TestingBridgeBootstrapDownloadInitialDelay, 3000);
|
||||
ENSURE_DEFAULT(TestingClientMaxIntervalWithoutRequest, 3000);
|
||||
ENSURE_DEFAULT(TestingDirConnectionMaxStall, 3000);
|
||||
ENSURE_DEFAULT(TestingAuthKeyLifetime, 3000);
|
||||
|
|
Loading…
Reference in New Issue