public Interrupters() { _msgInt = new IntervalInterrupter (TimeSpan.FromMilliseconds (100), "MessagingSocket Interval Interrupter"); _dhtInt = new IntervalInterrupter (TimeSpan.FromSeconds (1), "DHT Timeout Check Interrupter"); _kbrInt = new IntervalInterrupter (TimeSpan.FromSeconds (10), "KBR Stabilize Interval Interrupter"); _anonInt = new IntervalInterrupter (TimeSpan.FromMilliseconds (100), "AnonymousRouter Timeout Check Interrupter"); _updateCheckInt = new IntervalInterrupter (TimeSpan.FromMilliseconds (500), "WebApp UpdateChecker"); _messagingInt = new IntervalInterrupter (TimeSpan.FromMilliseconds (100), "AnonymousMessagingSocket RetryTimer"); _streamTimeoutInt = new IntervalInterrupter (TimeSpan.FromMilliseconds (100), "StreamSocket TimeoutTimer"); _mkdTimer = new IntervalInterrupter (TimeSpan.FromSeconds (5), "MassKeyDeliver Timer"); _dfsRePutTimer = new IntervalInterrupter (TimeSpan.FromSeconds (1), "DFS RePut Timer"); _crawlingInt = new IntervalInterrupter (TimeSpan.FromSeconds (10), "Crawling Timer"); _statInt = new IntervalInterrupter (TimeSpan.FromSeconds (1), "Statistics Update Thread"); _msgInt.Start (); _dhtInt.Start (); _kbrInt.Start (); _anonInt.Start (); _updateCheckInt.Start (); _messagingInt.Start (); _streamTimeoutInt.Start (); _mkdTimer.Start (); _dfsRePutTimer.Start (); _crawlingInt.Start (); _statInt.Start (); }
public void Evaluate(EvalOptionSet opt) { using (EvalEnvironment env = new EvalEnvironment (opt)) { env.AddNodes (opt.NumberOfNodes, true); env.StartChurn (); ISubscribeInfo subscribeInfo1 = env.Nodes[0].Subscribe (); ISubscribeInfo subscribeInfo2 = env.Nodes[1].Subscribe (); while (true) { if (subscribeInfo1.Status == SubscribeRouteStatus.Stable && subscribeInfo2.Status == SubscribeRouteStatus.Stable) break; Thread.Sleep (10); } bool routeEstablished = false; IAnonymousSocket sock1 = null, sock2 = null; StreamSocket strm1 = null, strm2 = null; do { int datasize = 1000 * 1000; IntervalInterrupter timeoutChecker = new IntervalInterrupter (TimeSpan.FromMilliseconds (100), "StreamSocket TimeoutChecker"); timeoutChecker.Start (); try { IAsyncResult ar = env.Nodes[0].AnonymousRouter.BeginConnect (subscribeInfo1.Key, subscribeInfo2.Key, AnonymousConnectionType.HighThroughput, null, null, null); sock1 = env.Nodes[0].AnonymousRouter.EndConnect (ar); if (env.Nodes[1].AnonymousSocketInfoList.Count == 0) throw new System.Net.Sockets.SocketException (); routeEstablished = true; sock2 = env.Nodes[1].AnonymousSocketInfoList[0].BaseSocket; strm1 = new StreamSocket (sock1, AnonymousRouter.DummyEndPoint, 500, timeoutChecker); strm2 = new StreamSocket (sock2, AnonymousRouter.DummyEndPoint, 500, timeoutChecker); sock1.InitializedEventHandlers (); sock2.InitializedEventHandlers (); Stopwatch sw = Stopwatch.StartNew (); byte[] data = new byte[datasize]; strm1.Send (data, 0, data.Length); strm1.Shutdown (); strm2.Shutdown (); Logger.Log (LogLevel.Info, this, "{0:f1}sec, {1:f2}Mbps", sw.Elapsed.TotalSeconds, datasize * 8 / sw.Elapsed.TotalSeconds / 1000.0 / 1000.0); } catch { } finally { timeoutChecker.Dispose (); if (sock1 != null) sock1.Dispose (); if (sock2 != null) sock2.Dispose (); if (strm1 != null) strm1.Dispose (); if (strm2 != null) strm2.Dispose (); } } while (!routeEstablished); } }
public KBREnvironment(bool enableDHT, bool enableAnon) { _network = new VirtualNetwork (LatencyTypes.Constant (20), 5, PacketLossType.Lossless (), 2); _interrupter = new IntervalInterrupter (TimeSpan.FromMilliseconds (50), "MessagingSocket Interrupter"); _interrupter.Start (); if (enableDHT || enableAnon) { _dhts = new List<IDistributedHashTable> (); _dhtInt = new IntervalInterrupter (TimeSpan.FromSeconds (5), "DHT Maintenance Interrupter"); _dhtInt.Start (); } if (enableAnon) { _anons = new List<IAnonymousRouter> (); _anonInt = new IntervalInterrupter (TimeSpan.FromMilliseconds (500), "Anonymous Interrupter"); _anonInt.Start (); } }
public EvalEnvironment(EvalOptionSet opt) { _opt = opt; _network = new VirtualNetwork (opt.GetLatency (), 5, opt.GetPacketLossRate (), Environment.ProcessorCount); _nodes = new List<VirtualNode> (); _msgInt1 = new IntervalInterrupter (TimeSpan.FromMilliseconds (50), "MessagingSocket Interrupter"); _msgInt2 = new IntervalInterrupter (TimeSpan.FromMilliseconds (50), "AnonymousMessagingSocket Interrupter"); _anonInt = new IntervalInterrupter (TimeSpan.FromMilliseconds (50), "Anonymous Interrupter"); _kbrInt = new IntervalInterrupter (TimeSpan.FromSeconds (10), "KBR Stabilize Interrupter"); _dhtInt = new IntervalInterrupter (TimeSpan.FromSeconds (10), "DHT Maintenance Interrupter"); _kbrInt.LoadEqualizing = true; _dhtInt.LoadEqualizing = true; _msgInt1.Start (); _msgInt2.Start (); _anonInt.Start (); _kbrInt.Start (); _dhtInt.Start (); if (opt.ChurnInterval > 0) _churnInt = new IntervalInterrupter (TimeSpan.FromMilliseconds (opt.ChurnInterval), "Churn Interrupter"); }
public virtual void Init() { _formatter = Serializer.Instance; _interrupter = new IntervalInterrupter (TimeSpan.FromMilliseconds (10.0), "Test IntervalInterrupter"); _interrupter.Start (); }