[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] The dicts and lists used for keeping track of answers should be instance attributes not class attributes
commit 15c501d57c1876a21ee60b53f0f38ee845ebe782
Author: Arturo Filastò <art@xxxxxxxxx>
Date: Sun Nov 25 16:28:16 2012 +0100
The dicts and lists used for keeping track of answers should be instance attributes not class attributes
---
ooni/utils/txscapy.py | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/ooni/utils/txscapy.py b/ooni/utils/txscapy.py
index 8e479f8..fbe9c38 100644
--- a/ooni/utils/txscapy.py
+++ b/ooni/utils/txscapy.py
@@ -148,16 +148,7 @@ class ScapyProtocol(object):
class ScapySender(ScapyProtocol):
timeout = 5
- # This dict is used to store the unique hashes that allow scapy to
- # match up request with answer
- hr_sent_packets = {}
-
- # These are the packets we have received as answer to the ones we sent
- answered_packets = []
-
- # These are the packets we send
- sent_packets = []
-
+
# This deferred will fire when we have finished sending a receiving packets.
# Should we look for multiple answers for the same sent packet?
multi = False
@@ -222,6 +213,16 @@ class ScapySender(ScapyProtocol):
self.factory.send(packet)
def startSending(self, packets):
+ # This dict is used to store the unique hashes that allow scapy to
+ # match up request with answer
+ self.hr_sent_packets = {}
+
+ # These are the packets we have received as answer to the ones we sent
+ self.answered_packets = []
+
+ # These are the packets we send
+ self.sent_packets = []
+
self._start_time = time.time()
self.d = defer.Deferred()
self.sendPackets(packets)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits