优化智能检查的初始化时机

This commit is contained in:
arraykeys@gmail.com
2018-07-12 13:32:46 +08:00
parent 8dce99fec6
commit f656773858
2 changed files with 9 additions and 3 deletions

View File

@ -189,7 +189,9 @@ func (s *HTTP) StopService() {
}
}()
s.isStop = true
if *s.cfg.Parent != "" {
s.checker.Stop()
}
if s.sshClient != nil {
s.sshClient.Close()
}

View File

@ -146,7 +146,9 @@ func (s *Socks) InitService() (err error) {
if *s.cfg.DNSAddress != "" {
(*s).domainResolver = utils.NewDomainResolver(*s.cfg.DNSAddress, *s.cfg.DNSTTL, s.log)
}
if *s.cfg.Parent != "" {
s.checker = utils.NewChecker(*s.cfg.Timeout, int64(*s.cfg.Interval), *s.cfg.Blocked, *s.cfg.Direct, s.log)
}
if *s.cfg.ParentType == "ssh" {
e := s.ConnectSSH()
if e != nil {
@ -193,7 +195,9 @@ func (s *Socks) StopService() {
}
}()
s.isStop = true
if *s.cfg.Parent != "" {
s.checker.Stop()
}
if s.sshClient != nil {
s.sshClient.Close()
}