Browse Source

Store the canonical DataSource in the TrafficTester.

Nick Mathewson 4 years ago
parent
commit
b9668e4d5d
2 changed files with 6 additions and 7 deletions
  1. 3 3
      lib/chutney/Traffic.py
  2. 3 4
      scripts/chutney_tests/verify.py

+ 3 - 3
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:

+ 3 - 4
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