public CommunicationManager() { _worker = new ClientWorker(); _peers = new ConcurrentDictionary<IPEndPoint, Peer>(); GlobalReceiveSpeedWatcher = new SpeedWatcher(); GlobalSendSpeedWatcher = new SpeedWatcher(); _worker.QueueForever(CalculateSpeed, 500.Milliseconds()); _worker.Start(); }
internal Peer(Stream stream, IConnection connection) { Connection = connection; SendSpeedWatcher = new SpeedWatcher(); ReceiveSpeedWatcher = new SpeedWatcher(); SendBandwidthController = new UnlimitedBandwidthController(); ReceiveBandwidthController = new UnlimitedBandwidthController(); Statistics = new PeerStat(); Stream = new ThrottledStream(stream, ReceiveBandwidthController, SendBandwidthController); Uri = new Uri("tcp://" + EndPoint.Address + ':' + EndPoint.Port); }