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

[tor-commits] [ooni-probe/master] Make inputProcessor setup be non-blocking



commit e08b3909b47ef451f84d8efc105c26ed4bcc2006
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Thu Jul 25 13:44:43 2013 +0200

    Make inputProcessor setup be non-blocking
---
 ooni/director.py |    1 +
 ooni/nettest.py  |   12 +++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/ooni/director.py b/ooni/director.py
index 2c48bb0..2ba9d30 100644
--- a/ooni/director.py
+++ b/ooni/director.py
@@ -224,6 +224,7 @@ class Director(object):
 
         yield net_test.report.open()
 
+        yield net_test.initializeInputProcessor()
         self.measurementManager.schedule(net_test.generateMeasurements())
 
         self.activeNetTests.append(net_test)
diff --git a/ooni/nettest.py b/ooni/nettest.py
index f940ae9..709e351 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -491,6 +491,13 @@ class NetTest(object):
 
         return measurement
 
+    @defer.inlineCallbacks
+    def initializeInputProcessor(self):
+        for test_class, _ in self.testCases:
+            test_class.inputs = yield defer.maybeDeferred(test_class().getInputProcessor)
+            if not test_class.inputs:
+                test_class.inputs = [None]
+
     def generateMeasurements(self):
         """
         This is a generator that yields measurements and registers the
@@ -499,11 +506,6 @@ class NetTest(object):
 
         for test_class, test_methods in self.testCases:
             # load the input processor as late as possible
-            inputs = yield defer.maybeDeferred(test_class().getInputProcessor())
-            if not inputs:
-                inputs = [None]
-            test_class.inputs = inputs
-
             for input in test_class.inputs:
                 for method in test_methods:
                     log.debug("Running %s %s" % (test_class, method))



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