mirror of
https://github.com/SteamRE/DepotDownloader.git
synced 2026-02-04 05:31:18 +01:00
Tick callbacks in an infinite task
This commit is contained in:
@@ -307,6 +307,8 @@ namespace DepotDownloader
|
||||
return false;
|
||||
}
|
||||
|
||||
Task.Run(steam3.TickCallbacks);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ namespace DepotDownloader
|
||||
int connectionBackoff;
|
||||
int seq; // more hack fixes
|
||||
AuthSession authSession;
|
||||
readonly CancellationTokenSource abortedToken = new();
|
||||
|
||||
// input
|
||||
readonly SteamUser.LogOnDetails logonDetails;
|
||||
@@ -122,6 +123,23 @@ namespace DepotDownloader
|
||||
return IsLoggedOn;
|
||||
}
|
||||
|
||||
public async Task TickCallbacks()
|
||||
{
|
||||
var token = abortedToken.Token;
|
||||
|
||||
try
|
||||
{
|
||||
while (!token.IsCancellationRequested)
|
||||
{
|
||||
await callbacks.RunWaitCallbackAsync(token);
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RequestAppInfo(uint appId, bool bForce = false)
|
||||
{
|
||||
if ((AppInfo.ContainsKey(appId) && !bForce) || bAborted)
|
||||
@@ -345,6 +363,7 @@ namespace DepotDownloader
|
||||
bAborted = true;
|
||||
bConnecting = false;
|
||||
bIsConnectionRecovery = false;
|
||||
abortedToken.Cancel();
|
||||
steamClient.Disconnect();
|
||||
|
||||
Ansi.Progress(Ansi.ProgressState.Hidden);
|
||||
|
||||
Reference in New Issue
Block a user