MCPcopy
hub / github.com/wavetermdev/waveterm / waitForDisconnect

Method waitForDisconnect

pkg/remote/conncontroller/conncontroller.go:999–1025  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

997}
998
999func (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
1027func (conn *SSHConn) SetWshError(err error) {
1028 conn.WithLock(func() {

Callers 1

connectInternalMethod · 0.95

Calls 7

FireConnChangeEventMethod · 0.95
GetClientMethod · 0.95
GetNameMethod · 0.95
WithLockMethod · 0.95
WaitMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected