From 42a5e652cb9dc9818abd63d93fd51e908f2c56a4 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 13 Oct 2020 14:37:40 -0400 Subject: Make OptimisticData always-on. We've been using it for years, and it seems to work just fine. This patch removes the option and its network parameter. Part of #40139 --- src/app/config/config.c | 2 +- src/app/config/or_options_st.h | 4 ---- src/core/or/circuituse.c | 25 ++++------------------ src/test/conf_examples/large_1/expected | 1 - src/test/conf_examples/large_1/expected_no_dirauth | 1 - 5 files changed, 5 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/app/config/config.c b/src/app/config/config.c index 0706a0dbdc..9625ed77fb 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -610,7 +610,7 @@ static const config_var_t option_vars_[] = { V(TestingAuthKeySlop, INTERVAL, "3 hours"), V(TestingSigningKeySlop, INTERVAL, "1 day"), - V(OptimisticData, AUTOBOOL, "auto"), + OBSOLETE("OptimisticData"), OBSOLETE("PortForwarding"), OBSOLETE("PortForwardingHelper"), OBSOLETE("PreferTunneledDirConns"), diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h index 7f201b8dd7..6a5d408c54 100644 --- a/src/app/config/or_options_st.h +++ b/src/app/config/or_options_st.h @@ -869,10 +869,6 @@ struct or_options_t { * once. */ int MaxClientCircuitsPending; - /** If 1, we always send optimistic data when it's supported. If 0, we - * never use it. If -1, we do what the consensus says. */ - int OptimisticData; - /** If 1, we accept and launch no external network connections, except on * control ports. */ int DisableNetwork; diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c index df23c63cff..9b506e67a1 100644 --- a/src/core/or/circuituse.c +++ b/src/core/or/circuituse.c @@ -2632,22 +2632,6 @@ cpath_is_on_circuit(origin_circuit_t *circ, crypt_path_t *crypt_path) return 0; } -/** Return true iff client-side optimistic data is supported. */ -static int -optimistic_data_enabled(void) -{ - const or_options_t *options = get_options(); - if (options->OptimisticData < 0) { - /* Note: this default was 0 before #18815 was merged. We can't take the - * parameter out of the consensus until versions before that are all - * obsolete. */ - const int32_t enabled = - networkstatus_get_param(NULL, "UseOptimisticData", /*default*/ 1, 0, 1); - return (int)enabled; - } - return options->OptimisticData; -} - /** Attach the AP stream apconn to circ's linked list of * p_streams. Also set apconn's cpath_layer to cpath, or to the last * hop in circ's cpath if cpath is NULL. @@ -2700,11 +2684,10 @@ link_apconn_to_circ(entry_connection_t *apconn, origin_circuit_t *circ, exitnode = node_get_by_id(cpath->extend_info->identity_digest); /* See if we can use optimistic data on this circuit */ - if (optimistic_data_enabled() && - (circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL || - circ->base_.purpose == CIRCUIT_PURPOSE_C_HSDIR_GET || - circ->base_.purpose == CIRCUIT_PURPOSE_S_HSDIR_POST || - circ->base_.purpose == CIRCUIT_PURPOSE_C_REND_JOINED)) + if (circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL || + circ->base_.purpose == CIRCUIT_PURPOSE_C_HSDIR_GET || + circ->base_.purpose == CIRCUIT_PURPOSE_S_HSDIR_POST || + circ->base_.purpose == CIRCUIT_PURPOSE_C_REND_JOINED) apconn->may_use_optimistic_data = 1; else apconn->may_use_optimistic_data = 0; diff --git a/src/test/conf_examples/large_1/expected b/src/test/conf_examples/large_1/expected index 99a12ffc84..7197993350 100644 --- a/src/test/conf_examples/large_1/expected +++ b/src/test/conf_examples/large_1/expected @@ -111,7 +111,6 @@ NumDirectoryGuards 4 NumEntryGuards 5 NumPrimaryGuards 8 OfflineMasterKey 1 -OptimisticData 1 ORPort 2222 OutboundBindAddress 10.0.0.7 OutboundBindAddressExit 10.0.0.8 diff --git a/src/test/conf_examples/large_1/expected_no_dirauth b/src/test/conf_examples/large_1/expected_no_dirauth index 26a33bdc7c..15919dae1b 100644 --- a/src/test/conf_examples/large_1/expected_no_dirauth +++ b/src/test/conf_examples/large_1/expected_no_dirauth @@ -110,7 +110,6 @@ NumDirectoryGuards 4 NumEntryGuards 5 NumPrimaryGuards 8 OfflineMasterKey 1 -OptimisticData 1 ORPort 2222 OutboundBindAddress 10.0.0.7 OutboundBindAddressExit 10.0.0.8 -- cgit v1.2.3-54-g00ecf