Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion shadowsocks-csharp/Model/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ protected ConfigurationWarning(System.Runtime.Serialization.SerializationInfo in
[Serializable]
public class Configuration
{
public int errorCount;
public int errorThreshold = 10;
public List<Server> configs;
public int index;
public bool random;
Expand Down Expand Up @@ -169,7 +171,13 @@ public static bool SetPasswordTry(string old_password, string password)

public bool KeepCurrentServer(int localPort, string targetAddr, string id)
{
if (sameHostForSameTarget && targetAddr != null)
if (errorThreshold)
{
if(errorCount < errorThreshold) return true;
errorCount = 0;
return false;
}
else if (sameHostForSameTarget && targetAddr != null)
{
lock (serverStrategyMap)
{
Expand Down Expand Up @@ -414,6 +422,8 @@ public Configuration()

public void CopyFrom(Configuration config)
{
errorCount = config.errorCount;
errorThreshold = config.errorThreshold;
configs = config.configs;
index = config.index;
random = config.random;
Expand Down
Loading