protected void EstablishConnection() { var node0 = Node0.Node; var node1 = Node1.Node; ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node0); mco.Start(); node0.AddConnectionOverlord(mco); mco.Set(node1.Address); EventHandler eh = delegate(object obj, EventArgs ea) { AreConnectedHandler(); }; _are_connected = new AreConnected(node0, node1, eh); _are_connected.Start(); }
protected Result DoNatTest(Simulator sim, Node node0, Node node1) { sim.Complete(true); // SimpleTimer.RunSteps(3600000); SimpleTimer.RunSteps(600000); long throughput = Throughput(node0.EdgeListenerList) + Throughput(node1.EdgeListenerList); DateTime start = DateTime.UtcNow; ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node0); mco.Start(); node0.AddConnectionOverlord(mco); mco.Set(node1.Address); AreConnected connected = new AreConnected(node0, node1, null); connected.Start(); connected.Run(120); long time = (DateTime.UtcNow - start).Ticks / TimeSpan.TicksPerMillisecond; double avg_throughput = 0; if(time > 0) { throughput = Throughput(node0.EdgeListenerList) + Throughput(node1.EdgeListenerList) - throughput; avg_throughput = (1.0 * throughput) / time / 1000; } sim.Disconnect(); return new Result(connected.TATypeAsString, time, avg_throughput); }
protected bool AreConnected(Node node0, Node node1) { Task connected = new AreConnected(node0, node1, null); connected.Start(); connected.Run(120); return connected.Done; }