Tick callbacks in an infinite task

pull/554/head
Pavel Djundik 11 months ago
parent 9ed8a70508
commit 6a9364029b

@ -307,6 +307,8 @@ namespace DepotDownloader
return false; return false;
} }
Task.Run(steam3.TickCallbacks);
return true; return true;
} }

@ -52,6 +52,7 @@ namespace DepotDownloader
int connectionBackoff; int connectionBackoff;
int seq; // more hack fixes int seq; // more hack fixes
AuthSession authSession; AuthSession authSession;
readonly CancellationTokenSource abortedToken = new();
// input // input
readonly SteamUser.LogOnDetails logonDetails; readonly SteamUser.LogOnDetails logonDetails;
@ -122,6 +123,23 @@ namespace DepotDownloader
return IsLoggedOn; 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) public async Task RequestAppInfo(uint appId, bool bForce = false)
{ {
if ((AppInfo.ContainsKey(appId) && !bForce) || bAborted) if ((AppInfo.ContainsKey(appId) && !bForce) || bAborted)
@ -345,6 +363,7 @@ namespace DepotDownloader
bAborted = true; bAborted = true;
bConnecting = false; bConnecting = false;
bIsConnectionRecovery = false; bIsConnectionRecovery = false;
abortedToken.Cancel();
steamClient.Disconnect(); steamClient.Disconnect();
Ansi.Progress(Ansi.ProgressState.Hidden); Ansi.Progress(Ansi.ProgressState.Hidden);

Loading…
Cancel
Save