|
|
@ -75,10 +75,7 @@ func (cc *Client) Run() error {
|
|
|
|
go cc.registerSignal()
|
|
|
|
go cc.registerSignal()
|
|
|
|
go func() {
|
|
|
|
go func() {
|
|
|
|
cc.sshConn.Wait()
|
|
|
|
cc.sshConn.Wait()
|
|
|
|
select {
|
|
|
|
close(cc.ch)
|
|
|
|
case cc.ch <- struct{}{}:
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
|
|
// wait exit signal
|
|
|
|
// wait exit signal
|
|
|
@ -308,10 +305,7 @@ func (cc *Client) keepAlive(interval time.Duration, maxCount int) {
|
|
|
|
Log(ERROR, "keep alive hit max count, exit")
|
|
|
|
Log(ERROR, "keep alive hit max count, exit")
|
|
|
|
cc.sshConn.Close()
|
|
|
|
cc.sshConn.Close()
|
|
|
|
// send exit signal
|
|
|
|
// send exit signal
|
|
|
|
select {
|
|
|
|
close(cc.ch)
|
|
|
|
case cc.ch <- struct{}{}:
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -325,9 +319,6 @@ func (cc *Client) registerSignal() {
|
|
|
|
case s1 := <-c:
|
|
|
|
case s1 := <-c:
|
|
|
|
cc.err = fmt.Errorf("signal %v", s1)
|
|
|
|
cc.err = fmt.Errorf("signal %v", s1)
|
|
|
|
Log(ERROR, "signal %d received, exit", s1)
|
|
|
|
Log(ERROR, "signal %d received, exit", s1)
|
|
|
|
select {
|
|
|
|
close(cc.ch)
|
|
|
|
case cc.ch <- struct{}{}:
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|