Skip to content
Permalink
Browse files
  • Loading branch information
Timothy A. Bish committed Dec 29, 2010
1 parent ad63bb0 commit ffffe9cef6db20e0d1c389756d16bad688e04c9c
Showing 1 changed file with 18 additions and 1 deletion.
@@ -61,6 +61,7 @@ public class FailoverTransport : ICompositeTransport, IComparable
private bool useExponentialBackOff = true;
private bool randomize = true;
private int maxReconnectAttempts;
private int startupMaxReconnectAttempts;
private int connectFailures;
private int reconnectDelay = 10;
private Exception connectionFailure;
@@ -196,6 +197,12 @@ public int MaxReconnectAttempts
set { maxReconnectAttempts = value; }
}

public int StartupMaxReconnectAttempts
{
get { return startupMaxReconnectAttempts; }
set { startupMaxReconnectAttempts = value; }
}

public bool Randomize
{
get { return randomize; }
@@ -824,7 +831,17 @@ private bool DoConnect()
}
}

if(MaxReconnectAttempts > 0 && ++connectFailures >= MaxReconnectAttempts)
int maxAttempts = 0;
if( firstConnection ) {
if( StartupMaxReconnectAttempts != 0 ) {
maxAttempts = StartupMaxReconnectAttempts;
}
}
if( maxAttempts == 0 ) {
maxAttempts = MaxReconnectAttempts;
}

if(maxAttempts > 0 && ++connectFailures >= maxAttempts)
{
Tracer.ErrorFormat("Failed to connect to transport after {0} attempt(s)", connectFailures);
connectionFailure = Failure;

0 comments on commit ffffe9c

Please sign in to comment.