Rename HTTP start context

This commit is contained in:
世界 2024-10-25 22:24:19 +08:00
parent 6ed9a06394
commit 327bb35ddd
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
5 changed files with 58 additions and 66 deletions

View file

@ -659,14 +659,15 @@ func (r *Router) Close() error {
func (r *Router) PostStart() error {
monitor := taskmonitor.New(r.logger, C.StopTimeout)
var cacheContext *adapter.HTTPStartContext
if len(r.ruleSets) > 0 {
monitor.Start("initialize rule-set")
ruleSetStartContext := NewRuleSetStartContext()
cacheContext = adapter.NewHTTPStartContext()
var ruleSetStartGroup task.Group
for i, ruleSet := range r.ruleSets {
ruleSetInPlace := ruleSet
ruleSetStartGroup.Append0(func(ctx context.Context) error {
err := ruleSetInPlace.StartContext(ctx, ruleSetStartContext)
err := ruleSetInPlace.StartContext(ctx, cacheContext)
if err != nil {
return E.Cause(err, "initialize rule-set[", i, "]")
}
@ -680,7 +681,9 @@ func (r *Router) PostStart() error {
if err != nil {
return err
}
ruleSetStartContext.Close()
}
if cacheContext != nil {
cacheContext.Close()
}
needFindProcess := r.needFindProcess
needWIFIState := r.needWIFIState