compute localIPs only once per server startup() (#19951)

repeatedly calling this function is not necessary,
on systems with lots of interfaces, including virtual
ones can make this reasonably delayed.
This commit is contained in:
Harshavardhana
2024-06-19 07:34:00 -07:00
committed by GitHub
parent ee48f9f206
commit 69e41f87ef
2 changed files with 30 additions and 15 deletions

View File

@@ -680,10 +680,8 @@ func getServerListenAddrs() []string {
// Use a string set to avoid duplication
addrs := set.NewStringSet()
// Listen on local interface to receive requests from Console
for _, ip := range mustGetLocalIPs() {
if ip != nil && ip.IsLoopback() {
addrs.Add(net.JoinHostPort(ip.String(), globalMinioPort))
}
for _, ip := range localLoopbacks.ToSlice() {
addrs.Add(net.JoinHostPort(ip, globalMinioPort))
}
host, _ := mustSplitHostPort(globalMinioAddr)
if host != "" {