communicator/ssh: remove background connection checker

Updated SSH package is supposed to be able to detect remote connection
closes now, which is nice.
This commit is contained in:
Mitchell Hashimoto 2014-04-28 15:25:59 -07:00
parent 32536b25af
commit a629f1655b
1 changed files with 0 additions and 40 deletions

View File

@ -14,7 +14,6 @@ import (
"os"
"path/filepath"
"sync"
"time"
)
type comm struct {
@ -117,45 +116,6 @@ func (c *comm) Start(cmd *packer.RemoteCmd) (err error) {
close(doneCh)
}()
go func() {
failures := 0
for {
log.Printf("[DEBUG] Background SSH connection checker is testing")
dummy, err := c.config.Connection()
if err == nil {
failures = 0
dummy.Close()
}
select {
case <-doneCh:
return
default:
}
if err != nil {
log.Printf("background SSH connection checker failure: %s", err)
failures += 1
}
if failures < 5 {
time.Sleep(5 * time.Second)
continue
}
// Acquire a lock in order to modify session state
sessionLock.Lock()
defer sessionLock.Unlock()
// Kill the connection and mark that we timed out.
log.Printf("Too many SSH connection failures. Killing it!")
c.conn.Close()
timedOut = true
return
}
}()
return
}