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(),
|
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||||
Timeout: 5 * time.Second,
|
Timeout: 5 * time.Second,
|
||||||
}
|
}
|
||||||
var c *ssh.Client
|
|
||||||
for {
|
for {
|
||||||
if c == nil {
|
glog.Infof("Dialing %s@%s", user, host)
|
||||||
var err error
|
c, err := ssh.Dial("tcp", host, config)
|
||||||
glog.Infof("Dialing %s@%s", user, host)
|
if err != nil {
|
||||||
c, err = ssh.Dial("tcp", host, config)
|
glog.Errorf("Error dialing %q: %v", host, err)
|
||||||
if err != nil {
|
|
||||||
glog.Errorf("Error dialing %q: %v", host, err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if c != nil {
|
if c != nil {
|
||||||
stats, err := fetchSnapshotStats(host, c)
|
stats, err := fetchSnapshotStats(host, c)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user