mirror of
https://github.com/SteamRE/DepotDownloader.git
synced 2026-10-20 01:46:17 +00:00
Use SteamContent.GetServersForSteamPipe
This commit is contained in:
1 parent
bef429908a
commit
e915870db7
2 files changed
+11
-23
No files matched your search
@@ -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<IReadOnlyCollection<Server>> 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;
|
||||
}
|
||||
|
||||
@@ -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<IPublishedFile> steamPublishedFile;
|
||||
@@ -101,6 +102,7 @@ namespace DepotDownloader
|
||||
this.steamCloud = this.steamClient.GetHandler<SteamCloud>();
|
||||
var steamUnifiedMessages = this.steamClient.GetHandler<SteamUnifiedMessages>();
|
||||
this.steamPublishedFile = steamUnifiedMessages.CreateService<IPublishedFile>();
|
||||
this.steamContent = this.steamClient.GetHandler<SteamContent>();
|
||||
|
||||
this.callbacks = new CallbackManager(this.steamClient);
|
||||
|
||||
|
||||
Reference in new issue
Block a user