If the content server client fails to open a storage session, keep retrying.

This behavior matches hldsupdatetool.
pull/8/head
Scott Ehlert 15 years ago
parent 5d4590e6cf
commit cd0014aab5

@ -14,6 +14,7 @@ namespace DepotDownloader
static class ContentDownloader static class ContentDownloader
{ {
const string DEFAULT_DIR = "depots"; const string DEFAULT_DIR = "depots";
const int STORAGE_RETRY_COUNT = 500;
static Steam3Session steam3; static Steam3Session steam3;
@ -165,23 +166,29 @@ namespace DepotDownloader
ContentServerClient csClient = new ContentServerClient(); ContentServerClient csClient = new ContentServerClient();
csClient.Connect( contentServer );
ContentServerClient.StorageSession session = null; ContentServerClient.StorageSession session = null;
int retryCount = 0;
while ( session == null )
{
try try
{ {
csClient.Connect( contentServer );
session = csClient.OpenStorage( ( uint )depotId, ( uint )depotVersion, ( uint )cellId, credentials ); session = csClient.OpenStorage( ( uint )depotId, ( uint )depotVersion, ( uint )cellId, credentials );
} }
catch ( Steam2Exception ex ) catch ( Steam2Exception ex )
{ {
Console.WriteLine( "Unable to open storage: " + ex.Message ); csClient.Disconnect();
retryCount++;
if (retryCount > STORAGE_RETRY_COUNT)
{
if (steam3 != null) if (steam3 != null)
steam3.Disconnect(); steam3.Disconnect();
return; return;
} }
}
}
using ( session ) using ( session )
{ {

Loading…
Cancel
Save