From 97b8716c86e23850d88c3b538b3947da67b55c7c Mon Sep 17 00:00:00 2001 From: Ryan Kistner Date: Sun, 8 Jan 2017 14:27:56 -0700 Subject: [PATCH] Pass appId all the way through for correctness --- DepotDownloader/CDNClientPool.cs | 18 +++++++++--------- DepotDownloader/ContentDownloader.cs | 8 ++++---- DepotDownloader/Steam3Session.cs | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/DepotDownloader/CDNClientPool.cs b/DepotDownloader/CDNClientPool.cs index 8b48dc5b..6cbac701 100644 --- a/DepotDownloader/CDNClientPool.cs +++ b/DepotDownloader/CDNClientPool.cs @@ -101,7 +101,7 @@ namespace DepotDownloader activeClientAuthed.TryRemove(client, out authData); } - private CDNClient BuildConnection(uint depotId, byte[] depotKey, CDNClient.Server serverSeed, CancellationToken token) + private CDNClient BuildConnection(uint appId, uint depotId, byte[] depotKey, CDNClient.Server serverSeed, CancellationToken token) { CDNClient.Server server = null; CDNClient client = null; @@ -130,7 +130,7 @@ namespace DepotDownloader if (server.Type == "CDN") { - steamSession.RequestCDNAuthToken(depotId, server.Host); + steamSession.RequestCDNAuthToken(appId, depotId, server.Host); cdnAuthToken = steamSession.CDNAuthTokens[Tuple.Create(depotId, server.Host)].Token; } @@ -157,7 +157,7 @@ namespace DepotDownloader return client; } - private bool ReauthConnection(CDNClient client, CDNClient.Server server, uint depotId, byte[] depotKey) + private bool ReauthConnection(CDNClient client, CDNClient.Server server, uint appId, uint depotId, byte[] depotKey) { DebugLog.Assert(server.Type == "CDN" || steamSession.AppTickets[depotId] == null, "CDNClientPool", "Re-authing a CDN or anonymous connection"); @@ -165,7 +165,7 @@ namespace DepotDownloader if (server.Type == "CDN") { - steamSession.RequestCDNAuthToken(depotId, server.Host); + steamSession.RequestCDNAuthToken(appId, depotId, server.Host); cdnAuthToken = steamSession.CDNAuthTokens[Tuple.Create(depotId, server.Host)].Token; } @@ -183,7 +183,7 @@ namespace DepotDownloader return false; } - public CDNClient GetConnectionForDepot(uint depotId, byte[] depotKey, CancellationToken token) + public CDNClient GetConnectionForDepot(uint appId, uint depotId, byte[] depotKey, CancellationToken token) { CDNClient client = null; @@ -194,24 +194,24 @@ namespace DepotDownloader // if we couldn't find a connection, make one now if (client == null) { - client = BuildConnection(depotId, depotKey, null, token); + client = BuildConnection(appId, depotId, depotKey, null, token); } // if we couldn't find the authorization data or it's not authed to this depotid, re-initialize if (!activeClientAuthed.TryGetValue(client, out authData) || authData.Item1 != depotId) { - if (authData.Item2.Type == "CDN" && ReauthConnection(client, authData.Item2, depotId, depotKey)) + if (authData.Item2.Type == "CDN" && ReauthConnection(client, authData.Item2, appId, depotId, depotKey)) { Console.WriteLine("Re-authed CDN connection to content server {0} from {1} to {2}", authData.Item2, authData.Item1, depotId); } - else if (authData.Item2.Type == "CS" && steamSession.AppTickets[depotId] == null && ReauthConnection(client, authData.Item2, depotId, depotKey)) + else if (authData.Item2.Type == "CS" && steamSession.AppTickets[depotId] == null && ReauthConnection(client, authData.Item2, appId, depotId, depotKey)) { Console.WriteLine("Re-authed anonymous connection to content server {0} from {1} to {2}", authData.Item2, authData.Item1, depotId); } else { ReleaseConnection(client); - client = BuildConnection(depotId, depotKey, authData.Item2, token); + client = BuildConnection(appId, depotId, depotKey, authData.Item2, token); } } diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index ba10ce3b..1db8f5c7 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -405,7 +405,7 @@ namespace DepotDownloader try { - DownloadSteam3(infos); + DownloadSteam3(appId, infos); } catch (OperationCanceledException) { @@ -478,7 +478,7 @@ namespace DepotDownloader public ProtoManifest.ChunkData NewChunk { get; private set; } } - private static void DownloadSteam3( List depots ) + private static void DownloadSteam3( uint appId, List depots ) { ulong TotalBytesCompressed = 0; ulong TotalBytesUncompressed = 0; @@ -537,7 +537,7 @@ namespace DepotDownloader { CDNClient client = null; try { - client = cdnPool.GetConnectionForDepot(depot.id, depot.depotKey, CancellationToken.None); + client = cdnPool.GetConnectionForDepot(appId, depot.id, depot.depotKey, CancellationToken.None); depotManifest = client.DownloadManifest(depot.id, depot.manifestId); @@ -755,7 +755,7 @@ namespace DepotDownloader CDNClient client; try { - client = cdnPool.GetConnectionForDepot(depot.id, depot.depotKey, cts.Token); + client = cdnPool.GetConnectionForDepot(appId, depot.id, depot.depotKey, cts.Token); } catch (OperationCanceledException) { diff --git a/DepotDownloader/Steam3Session.cs b/DepotDownloader/Steam3Session.cs index 575ba89c..80bc16b3 100644 --- a/DepotDownloader/Steam3Session.cs +++ b/DepotDownloader/Steam3Session.cs @@ -283,7 +283,7 @@ namespace DepotDownloader }, () => { return completed; }); } - public void RequestCDNAuthToken(uint depotid, string host) + public void RequestCDNAuthToken(uint appid, uint depotid, string host) { if (CDNAuthTokens.ContainsKey(Tuple.Create(depotid, host)) || bAborted) return; @@ -305,7 +305,7 @@ namespace DepotDownloader WaitUntilCallback(() => { - callbacks.Subscribe(steamApps.GetCDNAuthToken(depotid, host), cbMethod); + callbacks.Subscribe(steamApps.GetCDNAuthToken(appid, depotid, host), cbMethod); }, () => { return completed; }); }