[tor-commits] [ooni-probe/master] Throw an error if the measurement timeout is less than the bridge_reachability timeout

art at torproject.org art at torproject.org
Thu Aug 7 14:11:52 UTC 2014


commit 003db989fbdad17d96e58a1043692cb6fc390014
Author: Arturo Filastò <art at fuffa.org>
Date:   Thu Aug 7 16:11:10 2014 +0200

    Throw an error if the measurement timeout is less than the bridge_reachability timeout
---
 ooni/errors.py                                |    3 +++
 ooni/nettests/blocking/bridge_reachability.py |    9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ooni/errors.py b/ooni/errors.py
index 58e609d..cd71316 100644
--- a/ooni/errors.py
+++ b/ooni/errors.py
@@ -299,6 +299,9 @@ class ReportLogExists(Exception):
     pass
 
 
+class InvalidConfigFile(Exception):
+    pass
+
 def get_error(error_key):
     if error_key == 'test-helpers-key-missing':
         return CouldNotFindTestHelper
diff --git a/ooni/nettests/blocking/bridge_reachability.py b/ooni/nettests/blocking/bridge_reachability.py
index a70c16f..77dfce9 100644
--- a/ooni/nettests/blocking/bridge_reachability.py
+++ b/ooni/nettests/blocking/bridge_reachability.py
@@ -7,8 +7,9 @@ from twisted.internet import reactor, error
 
 import txtorcon
 
+from ooni.settings import config
 from ooni.utils import log, onion
-from ooni import nettest
+from ooni import nettest, errors
 
 
 class TorIsNotInstalled(Exception):
@@ -48,6 +49,12 @@ class BridgeReachability(nettest.NetTestCase):
         self.tor_progress = 0
         self.timeout = int(self.localOptions['timeout'])
 
+        if self.timeout > config.advanced.measurement_timeout:
+            log.err("The measurement timeout is less than the bridge reachability test timeout")
+            log.err("Adjust your ooniprobe.conf file by setting the "
+                    "advanced: measurement_timeout: value to %d" % self.timeout)
+            raise errors.InvalidConfigFile("advanced->measurement_timeout < %d" % self.timeout)
+
         self.report['error'] = None
         self.report['success'] = None
         self.report['timeout'] = self.timeout



More information about the tor-commits mailing list