Skip to content

Commit

Permalink
Revert 'Added support for CDN content servers'
Browse files Browse the repository at this point in the history
  • Loading branch information
azuisleet committed Mar 17, 2014
1 parent c1c4ef5 commit fdba42d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 45 deletions.
19 changes: 4 additions & 15 deletions DepotDownloader/ContentDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,15 @@ static class ContentDownloader
private sealed class DepotDownloadInfo
{
public uint id { get; private set; }
public uint appId { get; private set; }
public string installDir { get; private set; }
public string contentName { get; private set; }

public ulong manifestId { get; private set; }
public byte[] depotKey;

public DepotDownloadInfo(uint depotid, uint appId, ulong manifestId, string installDir, string contentName)
public DepotDownloadInfo(uint depotid, ulong manifestId, string installDir, string contentName)
{
this.id = depotid;
this.appId = appId;
this.manifestId = manifestId;
this.installDir = installDir;
this.contentName = contentName;
Expand Down Expand Up @@ -421,7 +419,7 @@ static DepotDownloadInfo GetDepotInfo(uint depotId, uint appId, string branch)

byte[] depotKey = steam3.DepotKeys[depotId];

var info = new DepotDownloadInfo( depotId, appId, manifestID, installDir, contentName );
var info = new DepotDownloadInfo( depotId, manifestID, installDir, contentName );
info.depotKey = depotKey;
return info;
}
Expand Down Expand Up @@ -450,16 +448,6 @@ private static List<CDNClient> CollectCDNClientsForDepot(DepotDownloadInfo depot
{
CDNClient c;

if (s.Type == "CDN")
{
// serialize access to steam3 if we are called from AsParallel code
lock (steam3)
{
steam3.RequestCDNAuthToken(depot.appId, s.Host);
s.CDNAuthToken = steam3.CDNAuthTokens[Tuple.Create(depot.appId, s.Host)].Token;
}
}

if ( tries == 0 )
{
c = initialClient;
Expand All @@ -477,8 +465,9 @@ private static List<CDNClient> CollectCDNClientsForDepot(DepotDownloadInfo depot
catch
{
Console.WriteLine( "\nFailed to connect to content server {0}. Remaining content servers for depot: {1}.", s, Config.MaxServers - tries - 1 );
tries++;
}

tries++;
}

if ( cdnClients.Count == 0 )
Expand Down
30 changes: 0 additions & 30 deletions DepotDownloader/Steam3Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public ReadOnlyCollection<SteamApps.LicenseListCallback.License> Licenses
public Dictionary<uint, byte[]> AppTickets { get; private set; }
public Dictionary<uint, ulong> AppTokens { get; private set; }
public Dictionary<uint, byte[]> DepotKeys { get; private set; }
public Dictionary<Tuple<uint, string>, SteamApps.CDNAuthTokenCallback> CDNAuthTokens { get; private set; }
public Dictionary<uint, SteamApps.PICSProductInfoCallback.PICSProductInfo> AppInfo { get; private set; }
public Dictionary<uint, SteamApps.PICSProductInfoCallback.PICSProductInfo> PackageInfo { get; private set; }

Expand Down Expand Up @@ -68,7 +67,6 @@ public Steam3Session( SteamUser.LogOnDetails details )
this.AppTickets = new Dictionary<uint, byte[]>();
this.AppTokens = new Dictionary<uint, ulong>();
this.DepotKeys = new Dictionary<uint, byte[]>();
this.CDNAuthTokens = new Dictionary<Tuple<uint, string>, SteamApps.CDNAuthTokenCallback>();
this.AppInfo = new Dictionary<uint, SteamApps.PICSProductInfoCallback.PICSProductInfo>();
this.PackageInfo = new Dictionary<uint, SteamApps.PICSProductInfoCallback.PICSProductInfo>();

Expand Down Expand Up @@ -281,34 +279,6 @@ public void RequestDepotKey(uint depotId, uint appid = 0)
}
}

public void RequestCDNAuthToken(uint appid, string host)
{
if (CDNAuthTokens.ContainsKey(Tuple.Create(appid, host)) || bAborted)
return;

Action<SteamApps.CDNAuthTokenCallback, JobID> cbMethod = (cdnAuth, jobId) =>
{
Console.WriteLine("Got CDN auth token for {0} result: {1}", host, cdnAuth.Result);
if (cdnAuth.Result != EResult.OK)
{
Abort();
return;
}
CDNAuthTokens[Tuple.Create(appid, host)] = cdnAuth;
};

using (var cdnAuthCallback = new JobCallback<SteamApps.CDNAuthTokenCallback>(cbMethod, callbacks, steamApps.GetCDNAuthToken(appid, host)))
{
do
{
WaitForCallbacks();
}
while (!cdnAuthCallback.Completed && !bAborted);
}
}

void Connect()
{
bAborted = false;
Expand Down

0 comments on commit fdba42d

Please sign in to comment.