Esempio n. 1
0
        public void Start(TrackerGetHooks hooks)
        {
            lock (this)
            {
                if (pipeline == null)
                {
                    pipeline = new LeakPipeline();
                    pipeline.Start();
                }

                if (worker == null)
                {
                    worker = new CompletionThread();
                    worker.Start();
                }

                if (service == null)
                {
                    service =
                        new TrackerGetBuilder()
                        .WithPipeline(pipeline)
                        .WithWorker(worker)
                        .Build(hooks);

                    service.Start();
                }
            }
        }
Esempio n. 2
0
        protected virtual void StartTrackerGet()
        {
            TrackerGetHooks hooks = new TrackerGetHooks
            {
                OnAnnounced = OnTrackerAnnounced
            };

            TrackerGet =
                new TrackerGetBuilder()
                .WithPipeline(Pipeline)
                .WithWorker(Worker)
                .WithPeer(Localhost)
                .Build(hooks);

            TrackerGet.Start();
        }
Esempio n. 3
0
        public void Stop()
        {
            lock (this)
            {
                if (service != null)
                {
                    service.Dispose();
                    service = null;
                }

                if (worker != null)
                {
                    worker.Dispose();
                    worker = null;
                }

                if (pipeline != null)
                {
                    pipeline?.Stop();
                    pipeline = null;
                }
            }
        }