Browse Source

Merge pull request #1618 from hyec/master

Close sockets before stop plugins

Do not activate all servers' plugins at the same time
tags/4.0.8
Allen Zhu GitHub 7 years ago
parent
commit
d1219bbfca
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 9 deletions
  1. +7
    -9
      shadowsocks-csharp/Controller/ShadowsocksController.cs

+ 7
- 9
shadowsocks-csharp/Controller/ShadowsocksController.cs View File

@@ -490,8 +490,6 @@ namespace Shadowsocks.Controller
protected void Reload() protected void Reload()
{ {
StopPlugins();
Encryption.RNG.Reload(); Encryption.RNG.Reload();
// some logic in configuration updated the config when saving, we need to read it again // some logic in configuration updated the config when saving, we need to read it again
_config = Configuration.Load(); _config = Configuration.Load();
@@ -521,6 +519,9 @@ namespace Shadowsocks.Controller
{ {
_listener.Stop(); _listener.Stop();
} }
StopPlugins();
// don't put PrivoxyRunner.Start() before pacServer.Stop() // don't put PrivoxyRunner.Start() before pacServer.Stop()
// or bind will fail when switching bind address from 0.0.0.0 to 127.0.0.1 // or bind will fail when switching bind address from 0.0.0.0 to 127.0.0.1
// though UseShellExecute is set to true now // though UseShellExecute is set to true now
@@ -534,7 +535,7 @@ namespace Shadowsocks.Controller
strategy.ReloadServers(); strategy.ReloadServers();
} }
StartPlugins();
StartPlugin();
privoxyRunner.Start(_config); privoxyRunner.Start(_config);
TCPRelay tcpRelay = new TCPRelay(this, _config); TCPRelay tcpRelay = new TCPRelay(this, _config);
@@ -572,13 +573,10 @@ namespace Shadowsocks.Controller
Utils.ReleaseMemory(true); Utils.ReleaseMemory(true);
} }
private void StartPlugins()
private void StartPlugin()
{ {
foreach (var server in _config.configs)
{
// Early start plugin processes
GetPluginLocalEndPointIfConfigured(server);
}
var server = _config.GetCurrentServer();
GetPluginLocalEndPointIfConfigured(server);
} }
protected void SaveConfig(Configuration newConfig) protected void SaveConfig(Configuration newConfig)


Loading…
Cancel
Save