(conn *SSHConn, client *ssh.Client)
| 31 | } |
| 32 | |
| 33 | func MakeConnMonitor(conn *SSHConn, client *ssh.Client) *ConnMonitor { |
| 34 | if conn == nil { |
| 35 | panic("conn cannot be nil") |
| 36 | } |
| 37 | if client == nil { |
| 38 | panic("client cannot be nil") |
| 39 | } |
| 40 | ctx, cancelFunc := context.WithCancel(context.Background()) |
| 41 | cm := &ConnMonitor{ |
| 42 | lock: &sync.Mutex{}, |
| 43 | Conn: conn, |
| 44 | Client: client, |
| 45 | ctx: ctx, |
| 46 | cancelFunc: cancelFunc, |
| 47 | inputNotifyCh: make(chan int64, 1), |
| 48 | } |
| 49 | go cm.keepAliveMonitor() |
| 50 | return cm |
| 51 | } |
| 52 | |
| 53 | // setConnHealthStatus calls into SSHConn.SetConnHealthStatus |
| 54 | // CRITICAL: cm.lock must NOT be held when calling this method (violates lock ordering) |
no test coverage detected