Fix: policy group unexpectedly closed
This commit is contained in:
parent
836f77f7ba
commit
7f31c3d7a4
3 changed files with 16 additions and 12 deletions
|
@ -264,16 +264,6 @@ func parseProxies(cfg *rawConfig) (map[string]C.Proxy, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
proxies["GLOBAL"], _ = adapters.NewSelector("GLOBAL", ps)
|
proxies["GLOBAL"], _ = adapters.NewSelector("GLOBAL", ps)
|
||||||
|
|
||||||
// close old goroutine
|
|
||||||
for _, proxy := range proxies {
|
|
||||||
switch raw := proxy.(type) {
|
|
||||||
case *adapters.URLTest:
|
|
||||||
raw.Close()
|
|
||||||
case *adapters.Fallback:
|
|
||||||
raw.Close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return proxies, nil
|
return proxies, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package executor
|
package executor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
adapters "github.com/Dreamacro/clash/adapters/outbound"
|
||||||
"github.com/Dreamacro/clash/config"
|
"github.com/Dreamacro/clash/config"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/Dreamacro/clash/constant"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/Dreamacro/clash/log"
|
||||||
|
@ -40,7 +41,20 @@ func GetGeneral() *config.General {
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateProxies(proxies map[string]C.Proxy) {
|
func updateProxies(proxies map[string]C.Proxy) {
|
||||||
T.Instance().UpdateProxies(proxies)
|
tunnel := T.Instance()
|
||||||
|
oldProxies := tunnel.Proxies()
|
||||||
|
|
||||||
|
// close old goroutine
|
||||||
|
for _, proxy := range oldProxies {
|
||||||
|
switch raw := proxy.(type) {
|
||||||
|
case *adapters.URLTest:
|
||||||
|
raw.Close()
|
||||||
|
case *adapters.Fallback:
|
||||||
|
raw.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tunnel.UpdateProxies(proxies)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateRules(rules []C.Rule) {
|
func updateRules(rules []C.Rule) {
|
||||||
|
|
Loading…
Reference in a new issue