Commit a629f165 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

communicator/ssh: remove background connection checker

Updated SSH package is supposed to be able to detect remote connection
closes now, which is nice.
parent 32536b25
......@@ -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
}
......
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