|
@@ -465,37 +465,19 @@ namespace Shadowsocks.Controller |
|
|
_config = Configuration.Load();
|
|
|
_config = Configuration.Load();
|
|
|
StatisticsConfiguration = StatisticsStrategyConfiguration.Load();
|
|
|
StatisticsConfiguration = StatisticsStrategyConfiguration.Load();
|
|
|
|
|
|
|
|
|
if (privoxyRunner == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
privoxyRunner = new PrivoxyRunner();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
privoxyRunner = privoxyRunner ?? new PrivoxyRunner();
|
|
|
|
|
|
|
|
|
if (_pacDaemon == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_pacDaemon = new PACDaemon();
|
|
|
|
|
|
_pacDaemon.PACFileChanged += PacDaemon_PACFileChanged;
|
|
|
|
|
|
_pacDaemon.UserRuleFileChanged += PacDaemon_UserRuleFileChanged;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
_pacDaemon = _pacDaemon ?? new PACDaemon();
|
|
|
|
|
|
_pacDaemon.PACFileChanged += PacDaemon_PACFileChanged;
|
|
|
|
|
|
_pacDaemon.UserRuleFileChanged += PacDaemon_UserRuleFileChanged;
|
|
|
|
|
|
_pacServer = _pacServer ?? new PACServer(_pacDaemon);
|
|
|
|
|
|
|
|
|
if (_pacServer == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_pacServer = new PACServer(_pacDaemon);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (gfwListUpdater == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
gfwListUpdater = new GFWListUpdater();
|
|
|
|
|
|
gfwListUpdater.UpdateCompleted += PacServer_PACUpdateCompleted;
|
|
|
|
|
|
gfwListUpdater.Error += PacServer_PACUpdateError;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
gfwListUpdater = gfwListUpdater ?? new GFWListUpdater();
|
|
|
|
|
|
gfwListUpdater.UpdateCompleted += PacServer_PACUpdateCompleted;
|
|
|
|
|
|
gfwListUpdater.Error += PacServer_PACUpdateError;
|
|
|
|
|
|
|
|
|
availabilityStatistics.UpdateConfiguration(this);
|
|
|
availabilityStatistics.UpdateConfiguration(this);
|
|
|
|
|
|
|
|
|
if (_listener != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_listener.Stop();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_listener?.Stop();
|
|
|
StopPlugins();
|
|
|
StopPlugins();
|
|
|
|
|
|
|
|
|
// don't put PrivoxyRunner.Start() before pacServer.Stop()
|
|
|
// don't put PrivoxyRunner.Start() before pacServer.Stop()
|
|
@@ -506,10 +488,7 @@ namespace Shadowsocks.Controller |
|
|
try
|
|
|
try
|
|
|
{
|
|
|
{
|
|
|
var strategy = GetCurrentStrategy();
|
|
|
var strategy = GetCurrentStrategy();
|
|
|
if (strategy != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
strategy.ReloadServers();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
strategy?.ReloadServers();
|
|
|
|
|
|
|
|
|
StartPlugin();
|
|
|
StartPlugin();
|
|
|
privoxyRunner.Start(_config);
|
|
|
privoxyRunner.Start(_config);
|
|
@@ -546,7 +525,6 @@ namespace Shadowsocks.Controller |
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
ConfigChanged?.Invoke(this, new EventArgs());
|
|
|
ConfigChanged?.Invoke(this, new EventArgs());
|
|
|
|
|
|
|
|
|
UpdateSystemProxy();
|
|
|
UpdateSystemProxy();
|
|
|
Utils.ReleaseMemory(true);
|
|
|
Utils.ReleaseMemory(true);
|
|
|
}
|
|
|
}
|
|
|