internal TorrentDownloadManager(PeerId localPeerId,
                                        IMainLoop mainLoop,
                                        IApplicationProtocol <PeerConnection> applicationProtocol,
                                        ITracker tracker,
                                        Metainfo description)
        {
            this.localPeerId    = localPeerId;
            this.mainLoop       = mainLoop;
            ApplicationProtocol = applicationProtocol;
            Description         = description;
            Tracker             = tracker;
            State                     = DownloadState.Pending;
            Downloaded                = 0;
            DownloadRateMeasurer      = new RateMeasurer();
            UploadRateMeasurer        = new RateMeasurer();
            progress                  = new Progress <StatusUpdate>();
            progress.ProgressChanged += ProgressChanged;

            pipeline = new PipelineBuilder()
                       .AddStage <VerifyDownloadedPiecesStage>()
                       .AddStage <DownloadPiecesStage>()
                       .Build();

            stageInterrupt = new StageInterrupt();
        }
        public PipelineRunner(ILogger <PipelineRunner> logger,
                              PeerId localPeerId,
                              IMainLoop mainLoop,
                              IApplicationProtocol applicationProtocol,
                              ITracker tracker,
                              IServiceProvider parentContainer,
                              IPipelineFactory pipelineFactory)
        {
            _logger             = logger;
            _localPeerId        = localPeerId;
            _mainLoop           = mainLoop;
            ApplicationProtocol = applicationProtocol;
            Description         = applicationProtocol.Metainfo;
            _parentContainer    = parentContainer;
            _pipelineFactory    = pipelineFactory;
            Tracker             = tracker;
            State = DownloadState.Pending;
            DownloadRateMeasurer       = new RateMeasurer();
            UploadRateMeasurer         = new RateMeasurer();
            _progress                  = new Progress <StatusUpdate>();
            _progress.ProgressChanged += ProgressChanged;

            _stageInterrupt = new StageInterrupt();
        }