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.IO.Compression;
using System.Diagnostics; using System.Diagnostics;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Net.Sockets;
namespace DepotDownloader namespace DepotDownloader
{ {
@ -503,22 +504,28 @@ namespace DepotDownloader
try try
{ {
csClient.Connect( contentServers[server] ); csClient.Connect( contentServers[server] );
session = csClient.OpenStorage( ( uint )depotId, ( uint )depotVersion, ( uint )Config.CellID, GetSteam2Credentials((uint)depotId) ); 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 ) catch ( Steam2Exception ex )
{ {
csClient.Disconnect(); csClient.Disconnect();
retryCount++; retryCount++;
server++; server = (server + 1) % contentServers.Length;
if (server >= contentServers.Length)
server = 0;
if ( retryCount > MAX_STORAGE_RETRIES ) if ( retryCount > MAX_STORAGE_RETRIES )
{ {
Console.WriteLine( "Unable to open storage: " + ex.Message ); Console.WriteLine( "Unable to open storage: " + ex.Message );
if (steam3 != null)
steam3.Disconnect();
return; return;
} }
} }
@ -605,10 +612,20 @@ namespace DepotDownloader
{ {
foreach ( IPEndPoint csdServer in ServerCache.CSDSServers ) foreach ( IPEndPoint csdServer in ServerCache.CSDSServers )
{ {
ContentServerDSClient csdsClient = new ContentServerDSClient(); ContentServer[] servers;
csdsClient.Connect( csdServer );
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 ) if ( servers == null )
{ {

Loading…
Cancel
Save