Browse Source

Use new grammar in Controller.Reload for readability

tags/4.1.9.0
Student Main 5 years ago
parent
commit
fb369a1e1e
1 changed files with 10 additions and 32 deletions
  1. +10
    -32
      shadowsocks-csharp/Controller/ShadowsocksController.cs

+ 10
- 32
shadowsocks-csharp/Controller/ShadowsocksController.cs View File

@@ -465,37 +465,19 @@ namespace Shadowsocks.Controller
_config = Configuration.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);
if (_listener != null)
{
_listener.Stop();
}
_listener?.Stop();
StopPlugins();
// don't put PrivoxyRunner.Start() before pacServer.Stop()
@@ -506,10 +488,7 @@ namespace Shadowsocks.Controller
try
{
var strategy = GetCurrentStrategy();
if (strategy != null)
{
strategy.ReloadServers();
}
strategy?.ReloadServers();
StartPlugin();
privoxyRunner.Start(_config);
@@ -546,7 +525,6 @@ namespace Shadowsocks.Controller
}
ConfigChanged?.Invoke(this, new EventArgs());
UpdateSystemProxy();
Utils.ReleaseMemory(true);
}


Loading…
Cancel
Save