Remove constructor setters

pull/474/head
Pavel Djundik 2 years ago
parent 7739fac67c
commit 93de24c7f5

@ -20,12 +20,12 @@ namespace DepotDownloader
public Client CDNClient { get; }
public Server ProxyServer { get; private set; }
private readonly ConcurrentStack<Server> activeConnectionPool;
private readonly BlockingCollection<Server> availableServerEndpoints;
private readonly ConcurrentStack<Server> activeConnectionPool = [];
private readonly BlockingCollection<Server> availableServerEndpoints = [];
private readonly AutoResetEvent populatePoolEvent;
private readonly AutoResetEvent populatePoolEvent = new(true);
private readonly Task monitorTask;
private readonly CancellationTokenSource shutdownToken;
private readonly CancellationTokenSource shutdownToken = new();
public CancellationTokenSource ExhaustedToken { get; set; }
public CDNClientPool(Steam3Session steamSession, uint appId)
@ -34,12 +34,6 @@ namespace DepotDownloader
this.appId = appId;
CDNClient = new Client(steamSession.steamClient);
activeConnectionPool = new ConcurrentStack<Server>();
availableServerEndpoints = [];
populatePoolEvent = new AutoResetEvent(true);
shutdownToken = new CancellationTokenSource();
monitorTask = Task.Factory.StartNew(ConnectionPoolMonitorAsync).Unwrap();
}

@ -1,5 +1,4 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
@ -31,13 +30,12 @@ namespace DepotDownloader
private set;
}
public Dictionary<uint, ulong> AppTokens { get; private set; }
public Dictionary<uint, ulong> PackageTokens { get; private set; }
public Dictionary<uint, byte[]> DepotKeys { get; private set; }
public ConcurrentDictionary<string, TaskCompletionSource<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; }
public Dictionary<string, byte[]> AppBetaPasswords { get; private set; }
public Dictionary<uint, ulong> AppTokens { get; } = [];
public Dictionary<uint, ulong> PackageTokens { get; } = [];
public Dictionary<uint, byte[]> DepotKeys { get; } = [];
public Dictionary<uint, SteamApps.PICSProductInfoCallback.PICSProductInfo> AppInfo { get; } = [];
public Dictionary<uint, SteamApps.PICSProductInfoCallback.PICSProductInfo> PackageInfo { get; } = [];
public Dictionary<string, byte[]> AppBetaPasswords { get; } = [];
public SteamClient steamClient;
public SteamUser steamUser;
@ -64,7 +62,7 @@ namespace DepotDownloader
readonly SteamUser.LogOnDetails logonDetails;
// output
readonly Credentials credentials;
readonly Credentials credentials = new();
static readonly TimeSpan STEAM3_TIMEOUT = TimeSpan.FromSeconds(30);
@ -72,23 +70,7 @@ namespace DepotDownloader
public Steam3Session(SteamUser.LogOnDetails details)
{
this.logonDetails = details;
this.authenticatedUser = details.Username != null || ContentDownloader.Config.UseQrCode;
this.credentials = new Credentials();
this.bConnected = false;
this.bConnecting = false;
this.bAborted = false;
this.bExpectingDisconnectRemote = false;
this.bDidDisconnect = false;
this.seq = 0;
this.AppTokens = [];
this.PackageTokens = [];
this.DepotKeys = [];
this.CDNAuthTokens = new ConcurrentDictionary<string, TaskCompletionSource<SteamApps.CDNAuthTokenCallback>>();
this.AppInfo = [];
this.PackageInfo = [];
this.AppBetaPasswords = [];
var clientConfiguration = SteamConfiguration.Create(config =>
config

Loading…
Cancel
Save