mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-09 10:33:14 +00:00
Fix package manager start order
This commit is contained in:
parent
c2354ebf25
commit
bb9bd9bff6
|
@ -531,6 +531,22 @@ func (r *Router) Start() error {
|
||||||
r.dnsClient.Start()
|
r.dnsClient.Start()
|
||||||
monitor.Finish()
|
monitor.Finish()
|
||||||
|
|
||||||
|
if C.IsAndroid && r.platformInterface == nil {
|
||||||
|
monitor.Start("initialize package manager")
|
||||||
|
packageManager, err := tun.NewPackageManager(r)
|
||||||
|
monitor.Finish()
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "create package manager")
|
||||||
|
}
|
||||||
|
monitor.Start("start package manager")
|
||||||
|
err = packageManager.Start()
|
||||||
|
monitor.Finish()
|
||||||
|
if err != nil {
|
||||||
|
return E.Cause(err, "start package manager")
|
||||||
|
}
|
||||||
|
r.packageManager = packageManager
|
||||||
|
}
|
||||||
|
|
||||||
for i, rule := range r.dnsRules {
|
for i, rule := range r.dnsRules {
|
||||||
monitor.Start("initialize DNS rule[", i, "]")
|
monitor.Start("initialize DNS rule[", i, "]")
|
||||||
err := rule.Start()
|
err := rule.Start()
|
||||||
|
@ -672,23 +688,7 @@ func (r *Router) PostStart() error {
|
||||||
needWIFIStateFromRuleSet = true
|
needWIFIStateFromRuleSet = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if needProcessFromRuleSet || r.needFindProcess || r.needPackageManager {
|
if needProcessFromRuleSet || r.needFindProcess {
|
||||||
if C.IsAndroid && r.platformInterface == nil {
|
|
||||||
monitor.Start("initialize package manager")
|
|
||||||
packageManager, err := tun.NewPackageManager(r)
|
|
||||||
monitor.Finish()
|
|
||||||
if err != nil {
|
|
||||||
return E.Cause(err, "create package manager")
|
|
||||||
}
|
|
||||||
monitor.Start("start package manager")
|
|
||||||
err = packageManager.Start()
|
|
||||||
monitor.Finish()
|
|
||||||
if err != nil {
|
|
||||||
return E.Cause(err, "start package manager")
|
|
||||||
}
|
|
||||||
r.packageManager = packageManager
|
|
||||||
}
|
|
||||||
|
|
||||||
if r.platformInterface != nil {
|
if r.platformInterface != nil {
|
||||||
r.processSearcher = r.platformInterface
|
r.processSearcher = r.platformInterface
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue