From 7eafae98d4ca01f11ee6c7859823411a929d9efd Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Mon, 18 Apr 2022 18:59:01 +0800 Subject: [PATCH] Turn off system proxy when not using proxy to update subscriptions --- v2rayN/v2rayN/Handler/UpdateHandle.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/v2rayN/v2rayN/Handler/UpdateHandle.cs b/v2rayN/v2rayN/Handler/UpdateHandle.cs index 50584ebb..bf3aacb7 100644 --- a/v2rayN/v2rayN/Handler/UpdateHandle.cs +++ b/v2rayN/v2rayN/Handler/UpdateHandle.cs @@ -178,6 +178,15 @@ namespace v2rayN.Handler Task.Run(async () => { + //Turn off system proxy + bool bSysProxyType = false; + if (!blProxy && config.sysProxyType == ESysProxyType.ForcedChange) + { + bSysProxyType = true; + config.sysProxyType = ESysProxyType.ForcedClear; + SysProxyHandle.UpdateSysProxy(config, false); + } + foreach (var item in config.subItem) { if (item.enabled == false) @@ -217,7 +226,14 @@ namespace v2rayN.Handler } _updateFunc(false, $"-------------------------------------------------------"); } + //restore system proxy + if (bSysProxyType) + { + config.sysProxyType = ESysProxyType.ForcedChange; + SysProxyHandle.UpdateSysProxy(config, false); + } _updateFunc(true, $"{ResUI.MsgUpdateSubscriptionEnd}"); + }); }