diff --git a/cmd/gluetun/main.go b/cmd/gluetun/main.go index 1596191f..1a018f9a 100644 --- a/cmd/gluetun/main.go +++ b/cmd/gluetun/main.go @@ -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, diff --git a/internal/httpproxy/loop.go b/internal/httpproxy/loop.go index a3b8e39f..ef0a0785 100644 --- a/internal/httpproxy/loop.go +++ b/internal/httpproxy/loop.go @@ -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