mirror of
https://github.com/minio/minio.git
synced 2025-01-27 06:33:18 -05:00
startup: specify the network - tcp4/tcp6 for ListenTCP()
This commit is contained in:
parent
2cba605514
commit
010e775b17
@ -19,6 +19,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -285,9 +286,18 @@ func checkPortAvailability(port int) {
|
|||||||
fatalIf(probe.NewError(e), fmt.Sprintf("Unable to list addresses on interface %s.", ifc.Name), nil)
|
fatalIf(probe.NewError(e), fmt.Sprintf("Unable to list addresses on interface %s.", ifc.Name), nil)
|
||||||
}
|
}
|
||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
ip := addr.(*net.IPNet).IP
|
ipnet, ok := addr.(*net.IPNet)
|
||||||
|
if !ok {
|
||||||
|
errorIf(probe.NewError(errors.New("")), "Interface type assertion to (*net.IPNet) failed.", nil)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
ip := ipnet.IP
|
||||||
|
network := "tcp4"
|
||||||
|
if ip.To4() == nil {
|
||||||
|
network = "tcp6"
|
||||||
|
}
|
||||||
tcpAddr := net.TCPAddr{IP: ip, Port: port, Zone: ifc.Name}
|
tcpAddr := net.TCPAddr{IP: ip, Port: port, Zone: ifc.Name}
|
||||||
l, e := net.ListenTCP("tcp", &tcpAddr)
|
l, e := net.ListenTCP(network, &tcpAddr)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
fatalIf(probe.NewError(e), fmt.Sprintf("Unable to listen on IP %s, port %.d", tcpAddr.IP, tcpAddr.Port), nil)
|
fatalIf(probe.NewError(e), fmt.Sprintf("Unable to listen on IP %s, port %.d", tcpAddr.IP, tcpAddr.Port), nil)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user