Files
docker-machine/ssh/ssh.go
T

23 lines
304 B
Go
Raw Normal View History

2014-12-04 15:05:11 +01:00
package ssh
2015-05-04 16:17:09 -07:00
import (
"net"
"time"
"github.com/docker/machine/log"
)
2014-12-04 15:05:11 +01:00
func WaitForTCP(addr string) error {
for {
2015-05-04 16:17:09 -07:00
log.Debugf("Testing TCP connection to: %s", addr)
conn, err := net.DialTimeout("tcp", addr, 2*time.Second)
2014-12-04 15:05:11 +01:00
if err != nil {
continue
}
2015-05-04 16:17:09 -07:00
2014-12-04 15:05:11 +01:00
defer conn.Close()
2015-05-04 16:17:09 -07:00
return nil
2014-12-04 15:05:11 +01:00
}
}