mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-04 18:59:08 +01:00
deactivate timer while connecting to new ssh
The new ssh setup handles timers differently from the old one due to the possibility of asking for user input multiple times. This limited the user input to entirely be done within 15 seconds. This removes that restriction which will allow those timers to increase. It does not impact the legacy ssh systems or the local connections on the new system.
This commit is contained in:
parent
e62540bdbe
commit
6bd60e8330
@ -262,8 +262,10 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> {
|
|||||||
message = "Connected and ready to run commands.";
|
message = "Connected and ready to run commands.";
|
||||||
} else if (remote.status == "connecting") {
|
} else if (remote.status == "connecting") {
|
||||||
message = remote.waitingforpassword ? "Connecting, waiting for user-input..." : "Connecting...";
|
message = remote.waitingforpassword ? "Connecting, waiting for user-input..." : "Connecting...";
|
||||||
let connectTimeout = remote.connecttimeout ?? 0;
|
if (remote.countdownactive) {
|
||||||
message = message + " (" + connectTimeout + "s)";
|
let connectTimeout = remote.connecttimeout ?? 0;
|
||||||
|
message = message + " (" + connectTimeout + "s)";
|
||||||
|
}
|
||||||
} else if (remote.status == "disconnected") {
|
} else if (remote.status == "disconnected") {
|
||||||
message = "Disconnected";
|
message = "Disconnected";
|
||||||
} else if (remote.status == "error") {
|
} else if (remote.status == "error") {
|
||||||
|
@ -108,6 +108,7 @@ type RemoteType = {
|
|||||||
remotevars: Record<string, string>;
|
remotevars: Record<string, string>;
|
||||||
status: RemoteStatusTypeStrs;
|
status: RemoteStatusTypeStrs;
|
||||||
connecttimeout: number;
|
connecttimeout: number;
|
||||||
|
countdownactive: boolean;
|
||||||
errorstr: string;
|
errorstr: string;
|
||||||
installstatus: string;
|
installstatus: string;
|
||||||
installerrorstr: string;
|
installerrorstr: string;
|
||||||
|
@ -601,6 +601,9 @@ func (msh *MShellProc) GetRemoteRuntimeState() RemoteRuntimeState {
|
|||||||
if state.ConnectTimeout < 0 {
|
if state.ConnectTimeout < 0 {
|
||||||
state.ConnectTimeout = 0
|
state.ConnectTimeout = 0
|
||||||
}
|
}
|
||||||
|
state.CountdownActive = true
|
||||||
|
} else {
|
||||||
|
state.CountdownActive = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vars := msh.Remote.StateVars
|
vars := msh.Remote.StateVars
|
||||||
@ -1317,23 +1320,22 @@ func (NewLauncher) Launch(msh *MShellProc, interactive bool) {
|
|||||||
if remoteCopy.ConnectMode != sstore.ConnectModeManual && remoteCopy.SSHOpts.SSHPassword == "" && !interactive {
|
if remoteCopy.ConnectMode != sstore.ConnectModeManual && remoteCopy.SSHOpts.SSHPassword == "" && !interactive {
|
||||||
sshOpts.BatchMode = true
|
sshOpts.BatchMode = true
|
||||||
}
|
}
|
||||||
makeClientCtx, makeClientCancelFn := context.WithCancel(context.Background())
|
|
||||||
defer makeClientCancelFn()
|
|
||||||
msh.WithLock(func() {
|
|
||||||
msh.Err = nil
|
|
||||||
msh.ErrNoInitPk = false
|
|
||||||
msh.Status = StatusConnecting
|
|
||||||
msh.MakeClientCancelFn = makeClientCancelFn
|
|
||||||
deadlineTime := time.Now().Add(RemoteConnectTimeout)
|
|
||||||
msh.MakeClientDeadline = &deadlineTime
|
|
||||||
go msh.NotifyRemoteUpdate()
|
|
||||||
})
|
|
||||||
go msh.watchClientDeadlineTime()
|
|
||||||
var cmdStr string
|
|
||||||
var cproc *shexec.ClientProc
|
var cproc *shexec.ClientProc
|
||||||
var initPk *packet.InitPacketType
|
var initPk *packet.InitPacketType
|
||||||
if sshOpts.SSHHost == "" && remoteCopy.Local {
|
if sshOpts.SSHHost == "" && remoteCopy.Local {
|
||||||
cmdStr, err = MakeLocalMShellCommandStr(remoteCopy.IsSudo())
|
makeClientCtx, makeClientCancelFn := context.WithCancel(context.Background())
|
||||||
|
defer makeClientCancelFn()
|
||||||
|
msh.WithLock(func() {
|
||||||
|
msh.Err = nil
|
||||||
|
msh.ErrNoInitPk = false
|
||||||
|
msh.Status = StatusConnecting
|
||||||
|
msh.MakeClientCancelFn = makeClientCancelFn
|
||||||
|
deadlineTime := time.Now().Add(RemoteConnectTimeout)
|
||||||
|
msh.MakeClientDeadline = &deadlineTime
|
||||||
|
go msh.NotifyRemoteUpdate()
|
||||||
|
})
|
||||||
|
go msh.watchClientDeadlineTime()
|
||||||
|
cmdStr, err := MakeLocalMShellCommandStr(remoteCopy.IsSudo())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
msh.WriteToPtyBuffer("*error, cannot find local mshell binary: %v\n", err)
|
msh.WriteToPtyBuffer("*error, cannot find local mshell binary: %v\n", err)
|
||||||
return
|
return
|
||||||
@ -1358,6 +1360,13 @@ func (NewLauncher) Launch(msh *MShellProc, interactive bool) {
|
|||||||
}
|
}
|
||||||
cproc, initPk, err = shexec.MakeClientProc(makeClientCtx, shexec.CmdWrap{Cmd: ecmd})
|
cproc, initPk, err = shexec.MakeClientProc(makeClientCtx, shexec.CmdWrap{Cmd: ecmd})
|
||||||
} else {
|
} else {
|
||||||
|
msh.WithLock(func() {
|
||||||
|
msh.Err = nil
|
||||||
|
msh.ErrNoInitPk = false
|
||||||
|
msh.Status = StatusConnecting
|
||||||
|
msh.MakeClientDeadline = nil
|
||||||
|
go msh.NotifyRemoteUpdate()
|
||||||
|
})
|
||||||
var client *ssh.Client
|
var client *ssh.Client
|
||||||
client, err = ConnectToClient(remoteCopy.SSHOpts)
|
client, err = ConnectToClient(remoteCopy.SSHOpts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1374,6 +1383,15 @@ func (NewLauncher) Launch(msh *MShellProc, interactive bool) {
|
|||||||
msh.setErrorStatus(statusErr)
|
msh.setErrorStatus(statusErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
makeClientCtx, makeClientCancelFn := context.WithCancel(context.Background())
|
||||||
|
defer makeClientCancelFn()
|
||||||
|
msh.WithLock(func() {
|
||||||
|
msh.MakeClientCancelFn = makeClientCancelFn
|
||||||
|
deadlineTime := time.Now().Add(RemoteConnectTimeout)
|
||||||
|
msh.MakeClientDeadline = &deadlineTime
|
||||||
|
go msh.NotifyRemoteUpdate()
|
||||||
|
})
|
||||||
|
go msh.watchClientDeadlineTime()
|
||||||
cproc, initPk, err = shexec.MakeClientProc(makeClientCtx, shexec.SessionWrap{Session: session, StartCmd: MakeServerRunOnlyCommandStr()})
|
cproc, initPk, err = shexec.MakeClientProc(makeClientCtx, shexec.SessionWrap{Session: session, StartCmd: MakeServerRunOnlyCommandStr()})
|
||||||
}
|
}
|
||||||
// TODO check if initPk.State is not nil
|
// TODO check if initPk.State is not nil
|
||||||
|
@ -960,6 +960,7 @@ type RemoteRuntimeState struct {
|
|||||||
DefaultFeState map[string]string `json:"defaultfestate"`
|
DefaultFeState map[string]string `json:"defaultfestate"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
ConnectTimeout int `json:"connecttimeout,omitempty"`
|
ConnectTimeout int `json:"connecttimeout,omitempty"`
|
||||||
|
CountdownActive bool `json:"countdownactive"`
|
||||||
ErrorStr string `json:"errorstr,omitempty"`
|
ErrorStr string `json:"errorstr,omitempty"`
|
||||||
InstallStatus string `json:"installstatus"`
|
InstallStatus string `json:"installstatus"`
|
||||||
InstallErrorStr string `json:"installerrorstr,omitempty"`
|
InstallErrorStr string `json:"installerrorstr,omitempty"`
|
||||||
|
Loading…
Reference in New Issue
Block a user