Retry all the connections

pull/8/head
azuisleet 14 years ago
parent 2295319fd2
commit 76258df7b7

@ -8,6 +8,7 @@ using System.IO;
using System.IO.Compression;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Net.Sockets;
namespace DepotDownloader
{
@ -505,20 +506,26 @@ namespace DepotDownloader
csClient.Connect( contentServers[server] );
session = csClient.OpenStorage( (uint)depotId, (uint)depotVersion, (uint)Config.CellID, GetSteam2Credentials( (uint)depotId ) );
}
catch ( SocketException ex )
{
retryCount++;
server = (server + 1) % contentServers.Length;
if ( retryCount > MAX_STORAGE_RETRIES )
{
Console.WriteLine( "Unable to connect to CS: " + ex.Message );
return;
}
}
catch ( Steam2Exception ex )
{
csClient.Disconnect();
retryCount++;
server++;
if (server >= contentServers.Length)
server = 0;
server = (server + 1) % contentServers.Length;
if ( retryCount > MAX_STORAGE_RETRIES )
{
Console.WriteLine( "Unable to open storage: " + ex.Message );
if (steam3 != null)
steam3.Disconnect();
return;
}
}
@ -604,11 +611,21 @@ namespace DepotDownloader
static IPEndPoint[] GetStorageServer( int depotId, int depotVersion, int cellId )
{
foreach ( IPEndPoint csdServer in ServerCache.CSDSServers )
{
ContentServer[] servers;
try
{
ContentServerDSClient csdsClient = new ContentServerDSClient();
csdsClient.Connect( csdServer );
ContentServer[] servers = csdsClient.GetContentServerList( ( uint )depotId, ( uint )depotVersion, ( uint )cellId );
servers = csdsClient.GetContentServerList( (uint)depotId, (uint)depotVersion, (uint)cellId );
}
catch ( SocketException )
{
servers = null;
continue;
}
if ( servers == null )
{

Loading…
Cancel
Save