[tor-commits] [ooni-probe/master] Avoid the sent and received reports being overwritten when calling multiple times self.sr

art at torproject.org art at torproject.org
Thu Nov 22 14:21:28 UTC 2012


commit 9af97ffe45ffe06766877ad1342efbc7c36a48b6
Author: Arturo Filastò <art at fuffa.org>
Date:   Thu Nov 22 15:19:53 2012 +0100

    Avoid the sent and received reports being overwritten when calling multiple times self.sr
---
 ooni/templates/scapyt.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ooni/templates/scapyt.py b/ooni/templates/scapyt.py
index 8d9ea8f..af90260 100644
--- a/ooni/templates/scapyt.py
+++ b/ooni/templates/scapyt.py
@@ -81,8 +81,11 @@ class BaseScapyTest(NetTestCase):
         """
         def finished(packets):
             answered, unanswered = packets
-            self.report['answered_packets'] = []
-            self.report['sent_packets'] = []
+            if 'answered_packets' not in self.report:
+                self.report['answered_packets'] = []
+            if 'sent_packets' not in self.report:
+                self.report['sent_packets'] = []
+
             for snd, rcv in answered:
                 log.debug("Writing report for scapy test")
                 sent_packet = snd





More information about the tor-commits mailing list