update and use rs/dnscache implementation instead of custom (#13348)

additionally optimize for IP only setups, avoid doing
unnecessary lookups if the Dial addr is an IP.

allow support for multiple listeners on same socket,
this is mainly meant for future purposes.
This commit is contained in:
Harshavardhana
2021-10-05 10:13:04 -07:00
committed by GitHub
parent fabf60bc4c
commit 3d5750f31c
16 changed files with 103 additions and 532 deletions

View File

@@ -18,6 +18,7 @@
package http
import (
"context"
"crypto/tls"
"errors"
"io/ioutil"
@@ -29,7 +30,6 @@ import (
humanize "github.com/dustin/go-humanize"
"github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/minio/internal/config"
"github.com/minio/minio/internal/config/api"
"github.com/minio/minio/internal/fips"
@@ -64,7 +64,7 @@ func (srv *Server) GetRequestCount() int {
}
// Start - start HTTP server
func (srv *Server) Start() (err error) {
func (srv *Server) Start(ctx context.Context) (err error) {
// Take a copy of server fields.
var tlsConfig *tls.Config
if srv.TLSConfig != nil {
@@ -72,12 +72,11 @@ func (srv *Server) Start() (err error) {
}
handler := srv.Handler // if srv.Handler holds non-synced state -> possible data race
addrs := set.CreateStringSet(srv.Addrs...).ToSlice() // copy and remove duplicates
// Create new HTTP listener.
var listener *httpListener
listener, err = newHTTPListener(
addrs,
ctx,
srv.Addrs,
)
if err != nil {
return err