public void AddTracker(IEnumerable <Uri> trackerURIs) { lock (_trackers) { foreach (Uri trackerURI in trackerURIs) { bool trackerExists = false; foreach (TrackerClient tracker in _trackers) { if (tracker.TrackerUri.Equals(trackerURI)) { trackerExists = true; break; } } if (!trackerExists) { TrackerClient tracker = TrackerClient.Create(trackerURI, _networkID.Number, TrackerClientID.CreateDefaultID(), _customUpdateInterval); tracker.Proxy = _proxy; _trackers.Add(tracker); } } } }
public void StartTracking(IEnumerable <Uri> trackerURIs = null) { lock (_trackers) { if (trackerURIs != null) { _trackers.Clear(); foreach (Uri trackerURI in trackerURIs) { TrackerClient tracker = TrackerClient.Create(trackerURI, _networkID.Number, TrackerClientID.CreateDefaultID(), _customUpdateInterval); tracker.Proxy = _proxy; _trackers.Add(tracker); } } if (_trackerUpdateTimer == null) { if ((_trackers.Count > 0) || (_ipv4DhtNode != null) || (_ipv6DhtNode != null)) { _trackerUpdateTimer = new Timer(TrackerUpdateTimerCallBack, TrackerClientEvent.Started, 1000, Timeout.Infinite); } } } }
public TrackerClient AddTracker(Uri trackerURI) { lock (_trackers) { foreach (TrackerClient tracker in _trackers) { if (tracker.TrackerUri.Equals(trackerURI)) { return(null); } } TrackerClient newTracker = TrackerClient.Create(trackerURI, _network.NetworkID.ID, TrackerClientID.CreateDefaultID()); _trackers.Add(newTracker); return(newTracker); } }
private void StartTracking(Uri[] trackerURIs) { _manager.StartLocalAnnouncement(_network.NetworkID); lock (_trackers) { _trackers.Clear(); foreach (Uri trackerURI in trackerURIs) { _trackers.Add(TrackerClient.Create(trackerURI, _network.NetworkID.ID, TrackerClientID.CreateDefaultID())); } } if (_trackerUpdateTimer == null) { _trackerUpdateTimer = new Timer(UpdateTracker, TrackerClientEvent.Started, 1000, Timeout.Infinite); } }
public TrackerClient AddTracker(Uri trackerURI) { lock (_trackers) { foreach (TrackerClient tracker in _trackers) { if (tracker.TrackerUri.Equals(trackerURI)) { return(null); } } { TrackerClient tracker = TrackerClient.Create(trackerURI, _networkID.Number, TrackerClientID.CreateDefaultID(), _customUpdateInterval); tracker.Proxy = _proxy; _trackers.Add(tracker); return(tracker); } } }