MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / WaitForConnect

Method WaitForConnect

pkg/remote/conncontroller/conncontroller.go:704–726  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

702}
703
704func (conn *SSHConn) WaitForConnect(ctx context.Context) error {
705 for {
706 status := conn.DeriveConnStatus()
707 if status.Status == Status_Connected {
708 return nil
709 }
710 if status.Status == Status_Connecting {
711 select {
712 case <-ctx.Done():
713 return fmt.Errorf("context timeout")
714 case <-time.After(100 * time.Millisecond):
715 continue
716 }
717 }
718 if status.Status == Status_Init || status.Status == Status_Disconnected {
719 return fmt.Errorf("disconnected")
720 }
721 if status.Status == Status_Error {
722 return fmt.Errorf("error: %v", status.Error)
723 }
724 return fmt.Errorf("unknown status: %q", status.Status)
725 }
726}
727
728// does not return an error since that error is stored inside of SSHConn
729func (conn *SSHConn) Connect(ctx context.Context, connFlags *wconfig.ConnKeywords) error {

Callers 1

EnsureConnectionFunction · 0.45

Calls 1

DeriveConnStatusMethod · 0.95

Tested by

no test coverage detected