diff --git a/DepotDownloader/CDNClientPool.cs b/DepotDownloader/CDNClientPool.cs index b0b8731b..aab33c9e 100644 --- a/DepotDownloader/CDNClientPool.cs +++ b/DepotDownloader/CDNClientPool.cs @@ -2,10 +2,8 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; -using System.Net; using System.Threading; using System.Threading.Tasks; -using SteamKit2; using SteamKit2.CDN; namespace DepotDownloader @@ -53,30 +51,18 @@ namespace DepotDownloader private async Task> FetchBootstrapServerListAsync() { - var backoffDelay = 0; - - while (!shutdownToken.IsCancellationRequested) + try { - try + var cdnServers = await this.steamSession.steamContent.GetServersForSteamPipe(); + if (cdnServers != null) { - var cdnServers = await ContentServerDirectoryService.LoadAsync(this.steamSession.steamClient.Configuration, ContentDownloader.Config.CellID, shutdownToken.Token); - if (cdnServers != null) - { - return cdnServers; - } - } - catch (Exception ex) - { - Console.WriteLine("Failed to retrieve content server list: {0}", ex.Message); - - if (ex is SteamKitWebRequestException e && e.StatusCode == (HttpStatusCode)429) - { - // If we're being throttled, add a delay to the next request - backoffDelay = Math.Min(5, ++backoffDelay); - await Task.Delay(TimeSpan.FromSeconds(backoffDelay)); - } + return cdnServers; } } + catch (Exception ex) + { + Console.WriteLine("Failed to retrieve content server list: {0}", ex.Message); + } return null; } diff --git a/DepotDownloader/Steam3Session.cs b/DepotDownloader/Steam3Session.cs index d669dc76..c2c24dcf 100644 --- a/DepotDownloader/Steam3Session.cs +++ b/DepotDownloader/Steam3Session.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -40,6 +40,7 @@ namespace DepotDownloader public SteamClient steamClient; public SteamUser steamUser; + public SteamContent steamContent; readonly SteamApps steamApps; readonly SteamCloud steamCloud; readonly SteamUnifiedMessages.UnifiedService steamPublishedFile; @@ -101,6 +102,7 @@ namespace DepotDownloader this.steamCloud = this.steamClient.GetHandler(); var steamUnifiedMessages = this.steamClient.GetHandler(); this.steamPublishedFile = steamUnifiedMessages.CreateService(); + this.steamContent = this.steamClient.GetHandler(); this.callbacks = new CallbackManager(this.steamClient);