[tor-commits] [chutney/master] Store the canonical DataSource in the TrafficTester.

teor at torproject.org teor at torproject.org
Thu Jun 20 07:45:41 UTC 2019


commit b9668e4d5ddbf1a8edcd2f3e768d9b46b5ac4404
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri May 10 11:15:21 2019 -0400

    Store the canonical DataSource in the TrafficTester.
---
 lib/chutney/Traffic.py          | 6 +++---
 scripts/chutney_tests/verify.py | 7 +++----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/chutney/Traffic.py b/lib/chutney/Traffic.py
index 72b9ca3..7ef3b2f 100755
--- a/lib/chutney/Traffic.py
+++ b/lib/chutney/Traffic.py
@@ -232,9 +232,9 @@ class Source(asynchat.async_chat):
     CONNECTING_THROUGH_PROXY = 2
     CONNECTED = 5
 
-    def __init__(self, tt, server, buf, proxy=None, repetitions=1):
+    def __init__(self, tt, server, proxy=None):
         asynchat.async_chat.__init__(self)
-        self.data_source = DataSource(buf, repetitions)
+        self.data_source = tt.data_source.copy()
         self.inbuf = b''
         self.proxy = proxy
         self.server = server
@@ -355,7 +355,7 @@ def main():
 
     tt = TrafficTester(bind_to, DATA)
     # Don't use a proxy for self-testing, so that we avoid tor entirely
-    tt.add(Source(tt, bind_to, DATA))
+    tt.add(Source(tt, bind_to))
     success = tt.run()
 
     if success:
diff --git a/scripts/chutney_tests/verify.py b/scripts/chutney_tests/verify.py
index 3e0455d..43100d6 100644
--- a/scripts/chutney_tests/verify.py
+++ b/scripts/chutney_tests/verify.py
@@ -155,8 +155,7 @@ def _configure_exits(tt, bind_to, tmpdata, reps, client_list, exit_list,
                      'localhost', op._env['socksport']))
             for _ in range(connection_count):
                 proxy = ('localhost', int(op._env['socksport']))
-                tt.add(chutney.Traffic.Source(tt, bind_to, tmpdata, proxy,
-                                              reps))
+                tt.add(chutney.Traffic.Source(tt, bind_to, proxy))
     return exit_path_node_count
 
 
@@ -188,8 +187,8 @@ def _configure_hs(tt, tmpdata, reps, client_list, hs_list, HS_PORT,
                      'localhost', client._env['socksport']))
             for _ in range(connection_count):
                 proxy = ('localhost', int(client._env['socksport']))
-                tt.add(chutney.Traffic.Source(tt, hs_bind_to, tmpdata,
-                                              proxy, reps))
+                tt.add(chutney.Traffic.Source(tt, hs_bind_to, proxy))
+
     return hs_path_node_count
 
 





More information about the tor-commits mailing list