From a3d309113cd0331c2fec7f1359ea01807d8ef6b6 Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Tue, 15 Dec 2020 17:11:25 +0800 Subject: [PATCH] fix: force using ss-libev if using plugin --- Netch/Servers/Shadowsocks/SSController.cs | 5 +---- Netch/Servers/Shadowsocks/Shadowsocks.cs | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Netch/Servers/Shadowsocks/SSController.cs b/Netch/Servers/Shadowsocks/SSController.cs index b24379ad..cc72f0f4 100644 --- a/Netch/Servers/Shadowsocks/SSController.cs +++ b/Netch/Servers/Shadowsocks/SSController.cs @@ -15,15 +15,13 @@ namespace Netch.Servers.Shadowsocks public ushort? Socks5LocalPort { get; set; } public string LocalAddress { get; set; } - private Mode _savedMode; public bool DllFlag; public bool Start(in Server s, in Mode mode) { - _savedMode = mode; Server = s; var server = (Shadowsocks) s; - DllFlag = Global.Settings.BootShadowsocksFromDLL && (_savedMode.Type == 0 || _savedMode.Type == 1 || _savedMode.Type == 2); + DllFlag = Global.Settings.BootShadowsocksFromDLL && mode.Type is 0 or 1 or 2 && !server.HasPlugin(); //从DLL启动Shaowsocks if (DllFlag) @@ -82,7 +80,6 @@ namespace Netch.Servers.Shadowsocks ShadowsocksDLL.Stop(); else StopInstance(); - _savedMode = null; } private class ShadowsocksDLL diff --git a/Netch/Servers/Shadowsocks/Shadowsocks.cs b/Netch/Servers/Shadowsocks/Shadowsocks.cs index 1c7cc98a..d44dcede 100644 --- a/Netch/Servers/Shadowsocks/Shadowsocks.cs +++ b/Netch/Servers/Shadowsocks/Shadowsocks.cs @@ -29,6 +29,8 @@ namespace Netch.Servers.Shadowsocks { Type = "SS"; } + + public bool HasPlugin() => string.IsNullOrWhiteSpace(Plugin) && string.IsNullOrWhiteSpace(PluginOption); } public static class SSGlobal