Browse Source

Configurable DirCache setting

Steven Engler 4 years ago
parent
commit
27f5c06de3
2 changed files with 9 additions and 1 deletions
  1. 8 1
      lib/chutney/TorNet.py
  2. 1 0
      torrc_templates/relay-non-exit.tmpl

+ 8 - 1
lib/chutney/TorNet.py

@@ -1867,6 +1867,7 @@ DEFAULTS = {
     'remote_net_dir': None,
     'num_additional_eventloops': None,
     'log_throughput': False,
+    'dircache': True,
 }
 
 
@@ -1936,7 +1937,10 @@ class TorEnviron(chutney.Templating.Environ):
         return my['socksport_base'] + my['nodenum']
 
     def _get_dirport(self, my):
-        return my['dirport_base'] + my['nodenum']
+        if my['dircache'] is True:
+            return my['dirport_base'] + my['nodenum']
+        else:
+            return 0
 
     def _get_extorport(self, my):
         return my['extorport_base'] + my['nodenum']
@@ -1984,6 +1988,9 @@ class TorEnviron(chutney.Templating.Environ):
     def _get_daemon_int(self, my):
         return 1 if self['daemon'] else 0
 
+    def _get_dircache_int(self, my):
+        return 1 if self['dircache'] else 0
+
     # A hs generates its key on first run,
     # so check for it at the last possible moment,
     # but cache it in memory to avoid repeatedly reading the file

+ 1 - 0
torrc_templates/relay-non-exit.tmpl

@@ -1,2 +1,3 @@
 ${include:relay-non-dir.tmpl}
 DirPort $dirport
+DirCache $dircache_int