mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
Fix: policy group unexpectedly closed
This commit is contained in:
parent
ca6e67a384
commit
da5db36ccf
|
@ -264,16 +264,6 @@ func parseProxies(cfg *rawConfig) (map[string]C.Proxy, error) {
|
|||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package executor
|
||||
|
||||
import (
|
||||
adapters "github.com/Dreamacro/clash/adapters/outbound"
|
||||
"github.com/Dreamacro/clash/config"
|
||||
C "github.com/Dreamacro/clash/constant"
|
||||
"github.com/Dreamacro/clash/log"
|
||||
|
@ -40,7 +41,20 @@ func GetGeneral() *config.General {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -72,7 +72,7 @@ func patchConfigs(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
type updateConfigRequest struct {
|
||||
Path string `json:"path"`
|
||||
Path string `json:"path"`
|
||||
}
|
||||
|
||||
func updateConfigs(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user