Code maintenance: http proxy starts from Run func

This commit is contained in:
Quentin McGaw
2020-12-30 22:02:47 +00:00
parent 251555f859
commit ea28c791e6
2 changed files with 7 additions and 4 deletions

View File

@@ -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,

View File

@@ -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