TryWaitForLoginKey should always attempt to wait a short period of time for login key updates if configured

pull/80/head
Ryan Kistner 6 years ago
parent def0729fce
commit 751538019b

@ -51,6 +51,7 @@ namespace DepotDownloader
bool bAborted; bool bAborted;
bool bExpectingDisconnectRemote; bool bExpectingDisconnectRemote;
bool bDidDisconnect; bool bDidDisconnect;
bool bDidReceiveLoginKey;
int connectionBackoff; int connectionBackoff;
int seq; // more hack fixes int seq; // more hack fixes
DateTime connectTime; DateTime connectTime;
@ -73,6 +74,9 @@ namespace DepotDownloader
this.bConnected = false; this.bConnected = false;
this.bConnecting = false; this.bConnecting = false;
this.bAborted = false; this.bAborted = false;
this.bExpectingDisconnectRemote = false;
this.bDidDisconnect = false;
this.bDidReceiveLoginKey = false;
this.seq = 0; this.seq = 0;
this.AppTickets = new Dictionary<uint, byte[]>(); this.AppTickets = new Dictionary<uint, byte[]>();
@ -416,6 +420,7 @@ namespace DepotDownloader
connectionBackoff = 0; connectionBackoff = 0;
bExpectingDisconnectRemote = false; bExpectingDisconnectRemote = false;
bDidDisconnect = false; bDidDisconnect = false;
bDidReceiveLoginKey = false;
this.connectTime = DateTime.Now; this.connectTime = DateTime.Now;
this.steamClient.Connect(); this.steamClient.Connect();
} }
@ -447,14 +452,14 @@ namespace DepotDownloader
{ {
if ( logonDetails.Username == null || !ContentDownloader.Config.RememberPassword ) return; if ( logonDetails.Username == null || !ContentDownloader.Config.RememberPassword ) return;
DateTime waitUntil = new DateTime().AddSeconds( 10 ); var totalWaitPeriod = DateTime.Now.AddSeconds( 3 );
while ( true ) while ( true )
{ {
DateTime now = new DateTime(); DateTime now = DateTime.Now;
if ( now >= waitUntil ) break; if ( now >= totalWaitPeriod ) break;
if ( AccountSettingsStore.Instance.LoginKeys.ContainsKey( logonDetails.Username ) ) break; if ( bDidReceiveLoginKey ) break;
callbacks.RunWaitAllCallbacks( TimeSpan.FromMilliseconds( 100 ) ); callbacks.RunWaitAllCallbacks( TimeSpan.FromMilliseconds( 100 ) );
} }
@ -655,6 +660,8 @@ namespace DepotDownloader
AccountSettingsStore.Save(); AccountSettingsStore.Save();
steamUser.AcceptNewLoginKey( loginKey ); steamUser.AcceptNewLoginKey( loginKey );
bDidReceiveLoginKey = true;
} }

Loading…
Cancel
Save