From ef67077fba6061a6e5b9a76caf60a33d17a81ce6 Mon Sep 17 00:00:00 2001 From: Karsten Loesing Date: Sat, 25 May 2013 12:21:09 +0200 Subject: Tweak TB_EMPTY event based on comments by nickm. - Avoid control_event_refill_global function with 13 arguments and increase code reuse factor by moving more code from control.c to connection.c. - Avoid an unsafe uint32_t -> int cast. - Add TestingEnableTbEmptyEvent option. - Prepare functions for testing. - Rename a few functions and improve documentation. --- src/or/config.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/or/config.c') diff --git a/src/or/config.c b/src/or/config.c index 7a17a9f1f8..4ca0338d74 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -220,6 +220,7 @@ static config_var_t option_vars_[] = { V(DownloadExtraInfo, BOOL, "0"), V(TestingEnableConnBwEvent, BOOL, "0"), V(TestingEnableCellStatsEvent, BOOL, "0"), + V(TestingEnableTbEmptyEvent, BOOL, "0"), V(EnforceDistinctSubnets, BOOL, "1"), V(EntryNodes, ROUTERSET, NULL), V(EntryStatistics, BOOL, "0"), @@ -465,6 +466,7 @@ static const config_var_t testing_tor_network_defaults[] = { V(MinUptimeHidServDirectoryV2, INTERVAL, "0 minutes"), V(TestingEnableConnBwEvent, BOOL, "1"), V(TestingEnableCellStatsEvent, BOOL, "1"), + V(TestingEnableTbEmptyEvent, BOOL, "1"), VAR("___UsingTestNetworkDefaults", BOOL, UsingTestNetworkDefaults_, "1"), { NULL, CONFIG_TYPE_OBSOLETE, 0, NULL } @@ -3252,6 +3254,12 @@ options_validate(or_options_t *old_options, or_options_t *options, "Tor networks!"); } + if (options->TestingEnableTbEmptyEvent && + !options->TestingTorNetwork && !options->UsingTestNetworkDefaults_) { + REJECT("TestingEnableTbEmptyEvent may only be changed in testing " + "Tor networks!"); + } + if (options->TestingTorNetwork) { log_warn(LD_CONFIG, "TestingTorNetwork is set. This will make your node " "almost unusable in the public Tor network, and is " -- cgit v1.2.3-54-g00ecf