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

[tor-commits] [ooni-probe/master] Remove dependency of NetTest on Director and Reporter



commit baefdaec6da774ada4c04ee270a510ae3614ce82
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Sat Jan 26 11:19:25 2013 +0000

    Remove dependency of NetTest on Director and Reporter
---
 ooni/nettest.py |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/ooni/nettest.py b/ooni/nettest.py
index bd019cc..61e6270 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -319,12 +319,16 @@ class NetTest(object):
         measurement = Measurement(test_class, test_method, test_input)
         measurement.netTest = self
 
-        measurement.done.addCallback(self.director.measurementSucceeded)
-        measurement.done.addErrback(self.director.measurementFailed, measurement)
+        if self.director:
+            measurement.done.addCallback(self.director.measurementSucceeded)
+            measurement.done.addErrback(self.director.measurementFailed, measurement)
+
+        if self.report:
+            measurement.done.addBoth(self.report.write)
+
+        if self.report and self.director:
+            measurement.done.addBoth(self.doneReport)
 
-        measurement.done.addBoth(self.report.write)
-        # here we are dealing with a deferred list
-        measurement.done.addBoth(self.doneReport)
         return measurement
 
     def generateMeasurements(self):



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