initialize forwarder after init() to avoid crashes (#11330)

DNSCache dialer is a global value initialized in
init(), whereas `go` keeps `var =` before `init()`
, also we don't need to keep proxy routers as
global entities - register the forwarder as
necessary to avoid crashes.
This commit is contained in:
Harshavardhana
2021-01-22 15:37:41 -08:00
committed by GitHub
parent a6c146bd00
commit 1b453728a3
3 changed files with 15 additions and 11 deletions

View File

@@ -25,6 +25,7 @@ import (
"github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio/pkg/bucket/bandwidth"
"github.com/minio/minio/pkg/handlers"
humanize "github.com/dustin/go-humanize"
"github.com/minio/minio/cmd/config/cache"
@@ -285,6 +286,8 @@ var (
globalProxyTransport http.RoundTripper
globalDNSCache *xhttp.DNSCache
globalForwarder *handlers.Forwarder
// Add new variable global values here.
)