Code maintenance: http proxy starts from Run func
This commit is contained in:
@@ -269,10 +269,6 @@ func _main(background context.Context, buildInfo models.BuildInformation,
|
||||
wg.Add(1)
|
||||
go shadowsocksLooper.Run(ctx, wg)
|
||||
|
||||
if allSettings.HTTPProxy.Enabled {
|
||||
_, _ = httpProxyLooper.SetStatus(constants.Running)
|
||||
}
|
||||
|
||||
wg.Add(1)
|
||||
go routeReadyEvents(ctx, wg, buildInfo, tunnelReadyCh, dnsReadyCh,
|
||||
unboundLooper, updaterLooper, publicIPLooper, routingConf, logger, httpClient,
|
||||
|
||||
@@ -54,6 +54,12 @@ func (l *looper) Run(ctx context.Context, wg *sync.WaitGroup) {
|
||||
|
||||
crashed := false
|
||||
|
||||
if l.GetSettings().Enabled {
|
||||
go func() {
|
||||
_, _ = l.SetStatus(constants.Running)
|
||||
}()
|
||||
}
|
||||
|
||||
select {
|
||||
case <-l.start:
|
||||
case <-ctx.Done():
|
||||
@@ -74,6 +80,7 @@ func (l *looper) Run(ctx context.Context, wg *sync.WaitGroup) {
|
||||
errorCh := make(chan error)
|
||||
go server.Run(runCtx, runWg, errorCh)
|
||||
|
||||
// TODO stable timer, check Shadowsocks
|
||||
if !crashed {
|
||||
l.running <- constants.Running
|
||||
crashed = false
|
||||
|
||||
Reference in New Issue
Block a user