common: don't wait SSH on first try

This commit is contained in:
Mitchell Hashimoto 2014-09-10 14:03:57 -07:00
parent b765b9ce1c
commit 42e9e734b9
2 changed files with 12 additions and 8 deletions

View File

@ -4,11 +4,10 @@ FEATURES:
* builder/vmware: VMware Fusion Pro 7 is now supported. [GH-1478]
IMPROVEMENTS:
BUG FIXES:
* build scripts: Windows executable renamed to packer.exe. [GH-1483]
* core: SSH will connect slightly faster if it is ready immediately.
* scripts: Windows executable renamed to packer.exe. [GH-1483]
## 0.7.0 (September 8, 2014)

View File

@ -98,13 +98,18 @@ func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, cancel <-chan stru
handshakeAttempts := 0
var comm packer.Communicator
first := true
for {
select {
case <-cancel:
log.Println("SSH wait cancelled. Exiting loop.")
return nil, errors.New("SSH wait cancelled")
case <-time.After(5 * time.Second):
// Don't check for cancel or wait on first iteration
if !first {
select {
case <-cancel:
log.Println("SSH wait cancelled. Exiting loop.")
return nil, errors.New("SSH wait cancelled")
case <-time.After(5 * time.Second):
}
}
first = false
// First we request the TCP connection information
address, err := s.SSHAddress(state)