Fix connection leak.
This was introduced when attempting to reuse ssh connection.
This commit is contained in:
parent
77a8833d70
commit
4bd757cb9d
@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
@ -28,8 +29,8 @@ var (
|
||||
|
||||
const snapshotListCmd = "/sbin/zfs list -t snapshot -H -o name -s name"
|
||||
|
||||
// Example: @auto-20171001.1400-2w
|
||||
var (
|
||||
// Example: @auto-20171001.1400-2w
|
||||
snapshotPattern = regexp.MustCompile(`^[^@]+@auto-(\d{8}\.\d{4})-\d+[mwy]$`)
|
||||
snapshotFormat = "20060102.1504"
|
||||
|
||||
@ -186,8 +187,8 @@ func main() {
|
||||
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
|
||||
Timeout: 5 * time.Second,
|
||||
}
|
||||
for {
|
||||
var c *ssh.Client
|
||||
for {
|
||||
if c == nil {
|
||||
var err error
|
||||
c, err = ssh.Dial("tcp", host, config)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user