()
| 997 | } |
| 998 | |
| 999 | func (conn *SSHConn) waitForDisconnect() { |
| 1000 | defer conn.FireConnChangeEvent() |
| 1001 | client := conn.GetClient() |
| 1002 | if client == nil { |
| 1003 | return |
| 1004 | } |
| 1005 | err := client.Wait() |
| 1006 | if err != nil { |
| 1007 | log.Printf("[conn:%s] client.Wait() returned error: %v", conn.GetName(), err) |
| 1008 | } else { |
| 1009 | log.Printf("[conn:%s] client.Wait() completed (clean disconnect)", conn.GetName()) |
| 1010 | } |
| 1011 | conn.lifecycleLock.Lock() |
| 1012 | defer conn.lifecycleLock.Unlock() |
| 1013 | conn.WithLock(func() { |
| 1014 | // disconnects happen for a variety of reasons (like network, etc. and are typically transient) |
| 1015 | // so we just set the status to "disconnected" here (not error) |
| 1016 | // don't overwrite any existing error (or error status) |
| 1017 | if err != nil && conn.Error == "" { |
| 1018 | conn.Error = err.Error() |
| 1019 | } |
| 1020 | if conn.Status != Status_Error { |
| 1021 | conn.Status = Status_Disconnected |
| 1022 | } |
| 1023 | }) |
| 1024 | conn.closeInternal_withlifecyclelock() |
| 1025 | } |
| 1026 | |
| 1027 | func (conn *SSHConn) SetWshError(err error) { |
| 1028 | conn.WithLock(func() { |
no test coverage detected