mirror of
https://github.com/SteamRE/DepotDownloader.git
synced 2026-10-19 15:51:50 +00:00
Updated ContentDownloader.CollectCDNClientsForDepot to reflect modified FetchServerList
This commit is contained in:
1 parent
933f0b28cf
commit
46659854cd
1 file changed
+17
-13
@@ -451,35 +451,39 @@ namespace DepotDownloader
|
||||
CDNClient initialClient = new CDNClient(steam3.steamClient, depot.id, steam3.AppTickets[depot.id], depot.depotKey);
|
||||
var cdnServers = initialClient.FetchServerList(cellId: (uint)Config.CellID);
|
||||
|
||||
if (cdnServers.Count == 0)
|
||||
{
|
||||
Console.WriteLine("\nUnable to find any content servers for depot {0} - {1}", depot.id, depot.contentName);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Grab up to the first eight server in the allegedly best-to-worst order from Steam
|
||||
Enumerable.Range(0, Math.Min(cdnServers.Count, Config.MaxServers)).ToList().ForEach(s =>
|
||||
var limit = cdnServers.Take( Config.MaxServers );
|
||||
int tries = 0;
|
||||
foreach( var s in limit )
|
||||
{
|
||||
CDNClient c;
|
||||
if( s == 0 )
|
||||
|
||||
if ( tries == 0 )
|
||||
{
|
||||
c = initialClient;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = new CDNClient(steam3.steamClient, depot.id, steam3.AppTickets[depot.id], depot.depotKey);
|
||||
c = new CDNClient( steam3.steamClient, depot.id, steam3.AppTickets[depot.id], depot.depotKey );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
c.Connect(cdnServers[s]);
|
||||
cdnClients.Add(c);
|
||||
c.Connect( s );
|
||||
cdnClients.Add( c );
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("\nFailed to connect to content server {0}. Remaining content servers for depot: {1}.", cdnServers[s], cdnServers.Count - s - 1);
|
||||
Console.WriteLine( "\nFailed to connect to content server {0}. Remaining content servers for depot: {1}.", s, Config.MaxServers - tries - 1 );
|
||||
}
|
||||
});
|
||||
|
||||
tries++;
|
||||
}
|
||||
|
||||
if ( cdnClients.Count == 0 )
|
||||
{
|
||||
Console.WriteLine( "\nUnable to find any content servers for depot {0} - {1}", depot.id, depot.contentName );
|
||||
}
|
||||
|
||||
return cdnClients;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user