mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-10-08 02:36:37 +08:00
增加协议屏蔽支持
This commit is contained in:
+11
-6
@@ -15,12 +15,14 @@ import (
|
||||
xmetrics "github.com/go-gost/x/metrics"
|
||||
metrics "github.com/go-gost/x/metrics/service"
|
||||
"github.com/go-gost/x/registry"
|
||||
xservice "github.com/go-gost/x/service"
|
||||
"github.com/judwhite/go-svc"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
type program struct {
|
||||
@@ -29,7 +31,6 @@ type program struct {
|
||||
srvProfiling *http.Server
|
||||
|
||||
cancel context.CancelFunc
|
||||
configReporter func() // 配置上报器启动函数
|
||||
}
|
||||
|
||||
func (p *program) Init(env svc.Environment) error {
|
||||
@@ -65,11 +66,6 @@ func (p *program) Start() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// 配置加载完成后启动配置上报器
|
||||
if p.configReporter != nil {
|
||||
go p.configReporter()
|
||||
}
|
||||
|
||||
if err := p.run(cfg); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -78,6 +74,15 @@ func (p *program) Start() error {
|
||||
p.cancel = cancel
|
||||
go p.reload(ctx)
|
||||
|
||||
go func() {
|
||||
select {
|
||||
case <-time.After(10 * time.Second):
|
||||
xservice.StartConfigReporter(ctx)
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user