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

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



commit 9af97ffe45ffe06766877ad1342efbc7c36a48b6
Author: Arturo Filastò <art@xxxxxxxxx>
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



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