[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Implementing bridge failover in ooniprobe (#540)



commit 6f8fe6f7fa9197b2465bcbe3374722803f6a24d0
Author: Arturo Filastò <arturo@xxxxxxxxxxx>
Date:   Wed Jun 29 16:38:09 2016 +0200

    Implementing bridge failover in ooniprobe (#540)
    
    * Implementing bridge failover in ooniprobe
    
    We support failing over to obfs4 and meek when vanilla tor does not work.
    
    * This implements #538
    
    * Reset the DataDirectory when we the data_dir is not set
    
    Otherwise txtorcon will delete the datadirectory after it shutsdown and not
    re-create it.
---
 ooni/utils/onion.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/ooni/utils/onion.py b/ooni/utils/onion.py
index cd13640..cc2f2ff 100644
--- a/ooni/utils/onion.py
+++ b/ooni/utils/onion.py
@@ -239,6 +239,19 @@ class TorLauncherWithRetries(object):
         self.tor_config = new_tor_config
         self.timeout = timeout
 
+    def _reset_tor_config(self):
+        """
+        This is used to reset the Tor configuration to before launch_tor
+        modified it. This is in particular used to force the regeneration of the
+        DataDirectory.
+        """
+        new_tor_config = TorConfig()
+        for key in self.tor_config:
+            if config.tor.data_dir is None and key == "DataDirectory":
+                continue
+            setattr(new_tor_config, key, getattr(self.tor_config, key))
+        self.tor_config = new_tor_config
+
     def _progress_updates(self, prog, tag, summary):
         log.msg("%d%%: %s" % (prog, summary))
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits