[tor-commits] [ooni-probe/master] Better handling of OONIB report closing.
art at torproject.org
art at torproject.org
Thu Jun 26 13:58:11 UTC 2014
commit 920eaebd5175f47f36e37c0d3ab666f054fa92a4
Author: Arturo Filastò <art at fuffa.org>
Date: Thu Jun 19 17:47:31 2014 +0200
Better handling of OONIB report closing.
---
ooni/nettests/blocking/dns_consistency.py | 7 +++----
ooni/reporter.py | 7 +++++--
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/ooni/nettests/blocking/dns_consistency.py b/ooni/nettests/blocking/dns_consistency.py
index 7959e99..23d7cfc 100644
--- a/ooni/nettests/blocking/dns_consistency.py
+++ b/ooni/nettests/blocking/dns_consistency.py
@@ -101,8 +101,8 @@ class DNSConsistencyTest(dnst.DNSTest):
the control resolver for every IP address we got back and check to see
if anyone of them matches the control ones.
- If they do, then we take note of the fact that censorship is probably not
- happening (tampering: reverse-match).
+ If they do, then we take note of the fact that censorship is probably
+ not happening (tampering: reverse-match).
If they do not match then censorship is probably going on (tampering:
true).
@@ -131,9 +131,8 @@ class DNSConsistencyTest(dnst.DNSTest):
try:
experiment_answers = yield self.performALookup(hostname,
test_dns_server)
- except Exception as e:
+ except Exception:
log.err("Problem performing the DNS lookup")
- log.exception(e)
self.report['tampering'][test_resolver] = 'dns_lookup_error'
continue
diff --git a/ooni/reporter.py b/ooni/reporter.py
index 8341b1a..b149b79 100644
--- a/ooni/reporter.py
+++ b/ooni/reporter.py
@@ -398,11 +398,10 @@ class OONIBReporter(OReporter):
log.debug("Created report with id %s" % parsed_response['report_id'])
defer.returnValue(parsed_response['report_id'])
- @defer.inlineCallbacks
def finish(self):
url = self.collectorAddress + '/report/' + self.reportID + '/close'
log.debug("Closing the report %s" % url)
- yield self.agent.request("POST", str(url))
+ return self.agent.request("POST", str(url))
class OONIBReportLog(object):
@@ -650,6 +649,9 @@ class Report(object):
def oonib_report_closed(result):
return self.report_log.closed(self.report_filename)
+ def oonib_report_failed(result):
+ log.err("Failed to close oonib report.")
+
def all_reports_closed(_):
if not d.called:
d.callback(None)
@@ -661,6 +663,7 @@ class Report(object):
if self.oonib_reporter:
close_oonib = self.oonib_reporter.finish()
close_oonib.addCallback(oonib_report_closed)
+ close_oonib.addErrback(oonib_report_failed)
deferreds.append(close_oonib)
dl = defer.DeferredList(deferreds)
More information about the tor-commits
mailing list