mirror of
https://github.com/SteamRE/DepotDownloader.git
synced 2026-10-19 15:51:50 +00:00
Cancel work if CDNClientPool is exhausted and can't find more servers
This commit is contained in:
1 parent
184ea54020
commit
65036ffa8d
2 files changed
+11
No files matched your search
@@ -24,6 +24,7 @@ namespace DepotDownloader
|
||||
|
||||
private AutoResetEvent populatePoolEvent;
|
||||
private Task monitorTask;
|
||||
public CancellationTokenSource ExhaustedToken { get; set; }
|
||||
|
||||
public CDNClientPool(Steam3Session steamSession)
|
||||
{
|
||||
@@ -61,6 +62,8 @@ namespace DepotDownloader
|
||||
|
||||
private async Task ConnectionPoolMonitorAsync()
|
||||
{
|
||||
bool didPopulate = false;
|
||||
|
||||
while(true)
|
||||
{
|
||||
populatePoolEvent.WaitOne(TimeSpan.FromSeconds(1));
|
||||
@@ -86,6 +89,12 @@ namespace DepotDownloader
|
||||
availableServerEndpoints.Add(endpoint.Item1);
|
||||
}
|
||||
}
|
||||
|
||||
didPopulate = true;
|
||||
}
|
||||
else if ( availableServerEndpoints.Count == 0 && !steamSession.steamClient.IsConnected && didPopulate )
|
||||
{
|
||||
ExhaustedToken?.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,6 +545,7 @@ namespace DepotDownloader
|
||||
Console.WriteLine( "Downloading depot {0} - {1}", depot.id, depot.contentName );
|
||||
|
||||
CancellationTokenSource cts = new CancellationTokenSource();
|
||||
cdnPool.ExhaustedToken = cts;
|
||||
|
||||
ProtoManifest oldProtoManifest = null;
|
||||
ProtoManifest newProtoManifest = null;
|
||||
@@ -874,6 +875,7 @@ namespace DepotDownloader
|
||||
if ( chunkData == null )
|
||||
{
|
||||
Console.WriteLine( "Failed to find any server with chunk {0} for depot {1}. Aborting.", chunkID, depot.id );
|
||||
cts.Cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user