[tor-commits] [tor/master] Rename *DownloadSchedule to *DownloadInitialDelay; make them ints

nickm at torproject.org nickm at torproject.org
Mon Apr 30 13:49:02 UTC 2018


commit 9aaed729c188a1f560d025388374c7dc1135478e
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Apr 18 10:53:39 2018 -0400

    Rename *DownloadSchedule to *DownloadInitialDelay; make them ints
    
    This commit won't compile. It was made with the following perl
    scripts:
    
    s/smartlist_t \*(.*)DownloadSchedule;/int $1DownloadInitialDelay;/;
    s/\b(\w*)DownloadSchedule\b/$1DownloadInitialDelay/;
---
 src/or/config.c         | 48 ++++++++++++++++++++++++------------------------
 src/or/directory.c      | 18 +++++++++---------
 src/or/or.h             | 18 +++++++++---------
 src/test/test_options.c | 12 ++++++------
 4 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index 9c0b321b5..a9d5b3a7a 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -599,14 +599,14 @@ 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, "
+  V(TestingServerDownloadInitialDelay, CSV_INTERVAL, "0, 0, 0, 60, 60, 120, "
                                  "300, 900, 2147483647"),
-  V(TestingClientDownloadSchedule, CSV_INTERVAL, "0, 0, 60, 300, 600, "
+  V(TestingClientDownloadInitialDelay, CSV_INTERVAL, "0, 0, 60, 300, 600, "
                                  "2147483647"),
-  V(TestingServerConsensusDownloadSchedule, CSV_INTERVAL, "0, 0, 60, "
+  V(TestingServerConsensusDownloadInitialDelay, CSV_INTERVAL, "0, 0, 60, "
                                  "300, 600, 1800, 1800, 1800, 1800, "
                                  "1800, 3600, 7200"),
-  V(TestingClientConsensusDownloadSchedule, CSV_INTERVAL, "0, 0, 60, "
+  V(TestingClientConsensusDownloadInitialDelay, CSV_INTERVAL, "0, 0, 60, "
                                  "300, 600, 1800, 3600, 3600, 3600, "
                                  "10800, 21600, 43200"),
   /* With the ClientBootstrapConsensus*Download* below:
@@ -624,12 +624,12 @@ 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,
+  V(ClientBootstrapConsensusAuthorityDownloadInitialDelay, CSV_INTERVAL,
     "6, 11, 3600, 10800, 25200, 54000, 111600, 262800" /* 3 days + 1 hour */),
-  V(ClientBootstrapConsensusFallbackDownloadSchedule, CSV_INTERVAL,
+  V(ClientBootstrapConsensusFallbackDownloadInitialDelay, CSV_INTERVAL,
     "0, 1, 4, 11, 3600, 10800, 25200, 54000, 111600, 262800"),
   /* When clients only have authorities available, they use this schedule: */
-  V(ClientBootstrapConsensusAuthorityOnlyDownloadSchedule, CSV_INTERVAL,
+  V(ClientBootstrapConsensusAuthorityOnlyDownloadInitialDelay, CSV_INTERVAL,
     "0, 3, 7, 3600, 10800, 25200, 54000, 111600, 262800"),
   /* 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
@@ -638,13 +638,13 @@ 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,
+  V(TestingBridgeDownloadInitialDelay, CSV_INTERVAL,
     "10800, 25200, 54000, 111600, 262800"),
   /* 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,
+  V(TestingBridgeBootstrapDownloadInitialDelay, CSV_INTERVAL,
     "0, 30, 90, 600, 3600, 10800, 25200, 54000, 111600, 262800"),
   V(TestingClientMaxIntervalWithoutRequest, INTERVAL, "10 minutes"),
   V(TestingDirConnectionMaxStall, INTERVAL, "5 minutes"),
@@ -672,11 +672,11 @@ 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,
+  V(ClientBootstrapConsensusAuthorityDownloadInitialDelay, CSV_INTERVAL,
     "0, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 16, 32, 60"),
-  V(ClientBootstrapConsensusFallbackDownloadSchedule, CSV_INTERVAL,
+  V(ClientBootstrapConsensusFallbackDownloadInitialDelay, CSV_INTERVAL,
     "0, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 16, 32, 60"),
-  V(ClientBootstrapConsensusAuthorityOnlyDownloadSchedule, CSV_INTERVAL,
+  V(ClientBootstrapConsensusAuthorityOnlyDownloadInitialDelay, CSV_INTERVAL,
     "0, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 16, 32, 60"),
   V(ClientDNSRejectInternalAddresses, BOOL,"0"),
   V(ClientRejectInternalAddresses, BOOL,   "0"),
@@ -692,16 +692,16 @@ 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, "
+  V(TestingServerDownloadInitialDelay, CSV_INTERVAL, "0, 0, 0, 5, 10, 15, "
                                  "20, 30, 60"),
-  V(TestingClientDownloadSchedule, CSV_INTERVAL, "0, 0, 5, 10, 15, 20, "
+  V(TestingClientDownloadInitialDelay, CSV_INTERVAL, "0, 0, 5, 10, 15, 20, "
                                  "30, 60"),
-  V(TestingServerConsensusDownloadSchedule, CSV_INTERVAL, "0, 0, 5, 10, "
+  V(TestingServerConsensusDownloadInitialDelay, CSV_INTERVAL, "0, 0, 5, 10, "
                                  "15, 20, 30, 60"),
-  V(TestingClientConsensusDownloadSchedule, CSV_INTERVAL, "0, 0, 5, 10, "
+  V(TestingClientConsensusDownloadInitialDelay, 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, "
+  V(TestingBridgeDownloadInitialDelay, CSV_INTERVAL, "10, 30, 60"),
+  V(TestingBridgeBootstrapDownloadInitialDelay, CSV_INTERVAL, "0, 0, 5, 10, "
                                  "15, 20, 30, 60"),
   V(TestingClientMaxIntervalWithoutRequest, INTERVAL, "5 seconds"),
   V(TestingDirConnectionMaxStall, INTERVAL, "30 seconds"),
@@ -4361,12 +4361,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);
diff --git a/src/or/directory.c b/src/or/directory.c
index c419b61d0..3e4d978ee 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -5311,14 +5311,14 @@ find_dl_schedule(const download_status_t *dls, const or_options_t *options)
       /* 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))) {
@@ -5326,33 +5326,33 @@ find_dl_schedule(const download_status_t *dls, const or_options_t *options)
           if (!networkstatus_consensus_can_use_extra_fallbacks(options)) {
             /* A bootstrapping client without extra fallback directories */
             return
-             options->ClientBootstrapConsensusAuthorityOnlyDownloadSchedule;
+             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);
diff --git a/src/or/or.h b/src/or/or.h
index c5a039e93..7c7f2083b 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -4316,19 +4316,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
@@ -4338,7 +4338,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
@@ -4348,7 +4348,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
@@ -4358,15 +4358,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
diff --git a/src/test/test_options.c b/src/test/test_options.c
index 9974ed257..65564f324 100644
--- a/src/test/test_options.c
+++ b/src/test/test_options.c
@@ -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);





More information about the tor-commits mailing list