Ejemplo n.º 1
0
        private async Task ContactTracker()
        {
            _logger.LogInformation("Contacting tracker");

            try
            {
                var request = new AnnounceRequest(
                    _localPeerId,
                    Remaining,
                    Downloaded,
                    Uploaded,
                    Description.InfoHash);

                var result = await Tracker.Announce(request);

                _logger.LogInformation($"{result.Peers.Count} peers available");

                ApplicationProtocol.PeersAvailable(result.Peers);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Unable to contact tracker");

                // Cannot connect to tracker
                State = DownloadState.Error;
            }
        }
        private async Task ContactTracker()
        {
            Log.LogInformation("Contacting tracker");

            try
            {
                var request = new AnnounceRequest(
                    localPeerId,
                    Remaining,
                    Description.InfoHash);

                var result = await Tracker.Announce(request);

                Log.LogInformation($"{result.Peers.Count} peers available");

                ApplicationProtocol.PeersAvailable(result.Peers);
            }
            catch (System.Net.Http.HttpRequestException)
            {
                // Cannot connect to tracker
                State = DownloadState.Error;
            }
        }