Browse Source

fix server index problem

tags/2.5.1
clowwindy 9 years ago
parent
commit
01c059c4e3
2 changed files with 20 additions and 1 deletions
  1. +6
    -1
      shadowsocks-csharp/Controller/ShadowsocksController.cs
  2. +14
    -0
      shadowsocks-csharp/Model/Configuration.cs

+ 6
- 1
shadowsocks-csharp/Controller/ShadowsocksController.cs View File

@@ -109,6 +109,10 @@ namespace Shadowsocks.Controller
{ {
return strategy.GetAServer(type, localIPEndPoint); return strategy.GetAServer(type, localIPEndPoint);
} }
if (_config.index < 0)
{
_config.index = 0;
}
return GetCurrentServer(); return GetCurrentServer();
} }
@@ -293,7 +297,8 @@ namespace Shadowsocks.Controller
polipoRunner.Stop(); polipoRunner.Stop();
try try
{ {
foreach (var strategy in GetStrategies())
var strategy = GetCurrentStrategy();
if (strategy != null)
{ {
strategy.ReloadServers(); strategy.ReloadServers();
} }


+ 14
- 0
shadowsocks-csharp/Model/Configuration.cs View File

@@ -55,6 +55,13 @@ namespace Shadowsocks.Model
{ {
config.localPort = 1080; config.localPort = 1080;
} }
if (config.index == -1)
{
if (config.strategy == null)
{
config.index = 0;
}
}
return config; return config;
} }
catch (Exception e) catch (Exception e)
@@ -86,6 +93,13 @@ namespace Shadowsocks.Model
{ {
config.index = -1; config.index = -1;
} }
if (config.index == -1)
{
if (config.strategy == null)
{
config.index = 0;
}
}
config.isDefault = false; config.isDefault = false;
try try
{ {


Loading…
Cancel
Save