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

[tor-commits] [onionperf/master] Work around Networkx's API change.



commit 5e5e4bcf482b961dfa8beaeef48a4feeae8bc67f
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Tue May 26 08:58:01 2020 +0200

    Work around Networkx's API change.
    
    Turns out that Networkx renamed the node attribute to nodes some time
    between version 2.2.1 and 2.4. This workaround avoids accessing that
    attribute to add another key/value pair to an existing node and
    instead uses two different key/value pair sets when adding the node in
    the first place. Not pretty, but works around the issue.
    
    Fixes #34298.
---
 onionperf/model.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/onionperf/model.py b/onionperf/model.py
index cd44118..1f4d9fe 100644
--- a/onionperf/model.py
+++ b/onionperf/model.py
@@ -69,9 +69,10 @@ class TorperfModel(GeneratableTGenModel):
         server_str = ','.join(self.tgen_servers)
         g = DiGraph()
 
-        g.add_node("start", serverport=self.tgen_port, peers=server_str, loglevel="info", heartbeat="1 minute")
         if self.socksproxy is not None:
-            g.node["start"]["socksproxy"] = self.socksproxy
+            g.add_node("start", serverport=self.tgen_port, peers=server_str, loglevel="info", heartbeat="1 minute", socksproxy=self.socksproxy)
+        else:
+            g.add_node("start", serverport=self.tgen_port, peers=server_str, loglevel="info", heartbeat="1 minute")
         g.add_node("pause", time="5 minutes")
         g.add_node("transfer5m", type="get", protocol="tcp", size="5 MiB", timeout="270 seconds", stallout="0 seconds")
 
@@ -98,9 +99,10 @@ class OneshotModel(GeneratableTGenModel):
         server_str = ','.join(self.tgen_servers)
         g = DiGraph()
 
-        g.add_node("start", serverport=self.tgen_port, peers=server_str, loglevel="info", heartbeat="1 minute")
         if self.socksproxy is not None:
-            g.node["start"]["socksproxy"] = self.socksproxy
+            g.add_node("start", serverport=self.tgen_port, peers=server_str, loglevel="info", heartbeat="1 minute", socksproxy=self.socksproxy)
+        else:
+            g.add_node("start", serverport=self.tgen_port, peers=server_str, loglevel="info", heartbeat="1 minute")
         g.add_node("transfer5m", type="get", protocol="tcp", size="5 MiB", timeout="15 seconds", stallout="10 seconds")
 
         g.add_edge("start", "transfer5m")

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