summaryrefslogtreecommitdiff
path: root/src/app/config
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-11-15 13:16:58 -0500
committerNick Mathewson <nickm@torproject.org>2018-11-26 16:32:40 -0500
commit3743f7969587079a2f2bb03d0b7e5038557fd64a (patch)
treeaf8e96b1be0384be223e96167065e76e96922727 /src/app/config
parent53ccdb6945f0d4a9b27a9939211a3c9125ca4427 (diff)
downloadtor-3743f7969587079a2f2bb03d0b7e5038557fd64a.tar.gz
tor-3743f7969587079a2f2bb03d0b7e5038557fd64a.zip
Add options to control dormant-client feature.
The DormantClientTimeout option controls how long Tor will wait before going dormant. It also provides a way to disable the feature by setting DormantClientTimeout to e.g. "50 years". The DormantTimeoutDisabledByIdleStreams option controls whether open but inactive streams count as "client activity". To implement it, I had to make it so that reading or writing on a client stream *always* counts as activity. Closes ticket 28429.
Diffstat (limited to 'src/app/config')
-rw-r--r--src/app/config/config.c6
-rw-r--r--src/app/config/or_options_st.h10
2 files changed, 16 insertions, 0 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 8aa0c1f4bd..90eae50fdd 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -389,6 +389,8 @@ static config_var_t option_vars_[] = {
OBSOLETE("DynamicDHGroups"),
VPORT(DNSPort),
OBSOLETE("DNSListenAddress"),
+ V(DormantClientTimeout, INTERVAL, "24 hours"),
+ V(DormantTimeoutDisabledByIdleStreams, BOOL, "1"),
/* DoS circuit creation options. */
V(DoSCircuitCreationEnabled, AUTOBOOL, "auto"),
V(DoSCircuitCreationMinConnections, UINT, "0"),
@@ -3836,6 +3838,10 @@ options_validate(or_options_t *old_options, or_options_t *options,
"default.");
}
+ if (options->DormantClientTimeout < 10*60 && !options->TestingTorNetwork) {
+ REJECT("DormantClientTimeout is too low. It must be at least 10 minutes.");
+ }
+
if (options->PathBiasNoticeRate > 1.0) {
tor_asprintf(msg,
"PathBiasNoticeRate is too high. "
diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h
index 3524b99b53..6cbc86ec18 100644
--- a/src/app/config/or_options_st.h
+++ b/src/app/config/or_options_st.h
@@ -1072,6 +1072,16 @@ struct or_options_t {
/** Autobool: Do we refuse single hop client rendezvous? */
int DoSRefuseSingleHopClientRendezvous;
+
+ /** Interval: how long without activity does it take for a client
+ * to become dormant?
+ **/
+ int DormantClientTimeout;
+
+ /** Boolean: true if having an idle stream is sufficient to prevent a client
+ * from becoming dormant.
+ **/
+ int DormantTimeoutDisabledByIdleStreams;
};
#endif