fix SSH ping timeout

This commit is contained in:
rui.zheng 2017-07-28 15:44:58 +08:00
parent 7ce6fa537b
commit 503568b093

View File

@ -279,10 +279,12 @@ func (s *sshSession) Ping(interval time.Duration, retries int) {
func (s *sshSession) sendPing() <-chan error { func (s *sshSession) sendPing() <-chan error {
ch := make(chan error, 1) ch := make(chan error, 1)
if _, _, err := s.client.SendRequest("ping", true, nil); err != nil { go func() {
ch <- err if _, _, err := s.client.SendRequest("ping", true, nil); err != nil {
} ch <- err
close(ch) }
close(ch)
}()
return ch return ch
} }