fix: Allow Walk to honor load balanced drives (#10610)

This commit is contained in:
Harshavardhana
2020-10-01 20:24:34 -07:00
committed by GitHub
parent 71403be912
commit 23e8390997
11 changed files with 57 additions and 47 deletions
+6 -14
View File
@@ -189,21 +189,13 @@ func isHostIP(ipAddress string) bool {
// Note: The check method tries to listen on given port and closes it.
// It is possible to have a disconnected client in this tiny window of time.
func checkPortAvailability(host, port string) (err error) {
network := []string{"tcp", "tcp4", "tcp6"}
for _, n := range network {
l, err := net.Listen(n, net.JoinHostPort(host, port))
if err == nil {
// As we are able to listen on this network, the port is not in use.
// Close the listener and continue check other networks.
if err = l.Close(); err != nil {
return err
}
} else {
return err
}
l, err := net.Listen("tcp", net.JoinHostPort(host, port))
if err != nil {
return err
}
return nil
// As we are able to listen on this network, the port is not in use.
// Close the listener and continue check other networks.
return l.Close()
}
// extractHostPort - extracts host/port from many address formats