Recreate the SSH connection every time through the loop.
This commit is contained in:
parent
ef80985ca6
commit
9c3a0b21cc
@ -255,15 +255,11 @@ func main() {
|
||||
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||
Timeout: 5 * time.Second,
|
||||
}
|
||||
var c *ssh.Client
|
||||
for {
|
||||
if c == nil {
|
||||
var err error
|
||||
glog.Infof("Dialing %s@%s", user, host)
|
||||
c, err = ssh.Dial("tcp", host, config)
|
||||
if err != nil {
|
||||
glog.Errorf("Error dialing %q: %v", host, err)
|
||||
}
|
||||
glog.Infof("Dialing %s@%s", user, host)
|
||||
c, err := ssh.Dial("tcp", host, config)
|
||||
if err != nil {
|
||||
glog.Errorf("Error dialing %q: %v", host, err)
|
||||
}
|
||||
if c != nil {
|
||||
stats, err := fetchSnapshotStats(host, c)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user