Disable Wsh on Remotes where the Domain Socket Listener Fails (#1542)

A recent change meant that if certain operations for setting up wsh
failed, a fallback would be employed to launch the terminal without the
wsh connection. This adds the domain socket listener to the list of
things that are allowed to fail before retrying without wsh instead of
failing outright.
This commit is contained in:
Sylvie Crowe 2024-12-17 12:22:57 -08:00 committed by GitHub
parent 95b1767c45
commit f5305cc8dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -509,11 +509,6 @@ func (conn *SSHConn) connectInternal(ctx context.Context, connFlags *wshrpc.Conn
conn.WithLock(func() {
conn.Client = client
})
err = conn.OpenDomainSocketListener()
if err != nil {
log.Printf("error: unable to open domain socket listener for %s: %v\n", conn.GetName(), err)
return err
}
config := wconfig.ReadFullConfig()
enableWsh := config.Settings.ConnWshEnabled
askBeforeInstall := config.Settings.ConnAskBeforeWshInstall
@ -545,15 +540,22 @@ func (conn *SSHConn) connectInternal(ctx context.Context, connFlags *wshrpc.Conn
}
if conn.WshEnabled.Load() {
csErr := conn.StartConnServer()
if csErr != nil {
log.Printf("error: unable to start conn server for %s: %v\n", conn.GetName(), csErr)
dsErr := conn.OpenDomainSocketListener()
var csErr error
if dsErr != nil {
log.Printf("error: unable to open domain socket listener for %s: %v\n", conn.GetName(), dsErr)
} else {
csErr = conn.StartConnServer()
if csErr != nil {
log.Printf("error: unable to start conn server for %s: %v\n", conn.GetName(), csErr)
}
}
if dsErr != nil || csErr != nil {
log.Print("attempting to run with nowsh instead")
conn.WithLock(func() {
conn.WshError = csErr.Error()
})
conn.WshEnabled.Store(false)
//return fmt.Errorf("conncontroller %s start wsh connserver error: %v", conn.GetName(), csErr)
}
}
} else {