Commit ebdfa2bc authored by Jason A. Beranek's avatar Jason A. Beranek

vmware-iso/driver-esxi: Fix VNC detection of used ports

  Fixes error in earlier commit that didn't properly detect a port
  was listened to.
parent 93e4475d
...@@ -169,14 +169,13 @@ func (d *ESX5Driver) VNCAddress(portMin, portMax uint) (string, uint, error) { ...@@ -169,14 +169,13 @@ func (d *ESX5Driver) VNCAddress(portMin, portMax uint) (string, uint, error) {
} }
for port := portMin; port <= portMax; port++ { for port := portMin; port <= portMax; port++ {
if _, ok := listenPorts[string(port)]; ok { if _, ok := listenPorts[fmt.Sprintf("%d", port)]; ok {
log.Printf("Port %d in use", port) log.Printf("Port %d in use", port)
continue continue
} }
address := fmt.Sprintf("%s:%d", d.Host, port) address := fmt.Sprintf("%s:%d", d.Host, port)
log.Printf("Trying address: %s...", address) log.Printf("Trying address: %s...", address)
l, err := net.DialTimeout("tcp", address, 1*time.Second) l, err := net.DialTimeout("tcp", address, 1*time.Second)
log.Printf("Dial complete address: %s...", address)
if err != nil { if err != nil {
if e, ok := err.(*net.OpError); ok { if e, ok := err.(*net.OpError); ok {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment