[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] Fix tcpconnect because we were not passing the main reactor to tests
commit 41f44d22174b301ca4c896f2891267ef2cdc7797
Author: Arturo Filastò <hellais@xxxxxxxxxxxxxx>
Date: Wed Jul 11 15:51:54 2012 +0200
Fix tcpconnect because we were not passing the main reactor to tests
Closes #6372
---
ooni/ooniprobe.py | 4 ++--
ooni/plugoo/work.py | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/ooni/ooniprobe.py b/ooni/ooniprobe.py
index 261eb74..d6de6a6 100755
--- a/ooni/ooniprobe.py
+++ b/ooni/ooniprobe.py
@@ -56,7 +56,7 @@ def retrieve_plugoo():
plugoo = retrieve_plugoo()
-def runTest(test, options, global_options, reactor=None):
+def runTest(test, options, global_options, reactor=reactor):
"""
Run an OONI probe test by name.
@@ -68,7 +68,7 @@ def runTest(test, options, global_options, reactor=None):
@param global_options: the global options for OONI
"""
parallelism = int(global_options['parallelism'])
- worker = work.Worker(parallelism)
+ worker = work.Worker(parallelism, reactor=reactor)
test_class = plugoo[test].__class__
report = reports.Report(test, global_options['output'])
diff --git a/ooni/plugoo/work.py b/ooni/plugoo/work.py
index a8b6595..6106456 100644
--- a/ooni/plugoo/work.py
+++ b/ooni/plugoo/work.py
@@ -24,11 +24,12 @@ class Worker(object):
This is the core of OONI. It takes as input Work Units and
runs them concurrently.
"""
- def __init__(self, maxconcurrent=10):
+ def __init__(self, maxconcurrent=10, reactor=reactor):
"""
@param maxconcurrent: how many test instances should be run
concurrently.
"""
+ self.reactor = reactor
self.maxconcurrent = maxconcurrent
self._running = 0
self._queued = []
@@ -54,7 +55,7 @@ class Worker(object):
r.trap()
if self._running == 0 and not self._queued:
- reactor.stop()
+ self.reactor.stop()
return r
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits