mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Respect user's plink timeout setting when plink takes longer than 2s after the first text output. Closes #1114
This commit is contained in:
@ -945,7 +945,7 @@ var
|
||||
rx: TRegExpr;
|
||||
StartupInfo: TStartupInfo;
|
||||
ExitCode: LongWord;
|
||||
Waited, ReturnedSomethingAt, PortChecks: Integer;
|
||||
Waited, PortChecks: Integer;
|
||||
begin
|
||||
// Check if local port is open
|
||||
PortChecks := 0;
|
||||
@ -1008,10 +1008,10 @@ begin
|
||||
raise EDbError.Create(ErrorText);
|
||||
end;
|
||||
|
||||
// Wait until timeout has finished, or some text returned.
|
||||
// Wait until timeout has finished.
|
||||
// Todo: Find a way to wait only until connection is established
|
||||
// Parse pipe output and probably show some message in a dialog.
|
||||
Waited := 0;
|
||||
ReturnedSomethingAt := -1;
|
||||
while Waited < FConnection.Parameters.SSHTimeout*1000 do begin
|
||||
Inc(Waited, 200);
|
||||
WaitForSingleObject(FProcessInfo.hProcess, 200);
|
||||
@ -1022,7 +1022,6 @@ begin
|
||||
OutText := Trim(ReadPipe(FOutPipe));
|
||||
ErrorText := ReadPipe(FErrorPipe);
|
||||
if (OutText <> '') or (ErrorText <> '') then begin
|
||||
ReturnedSomethingAt := Waited;
|
||||
FConnection.Log(lcDebug, Format('PLink output after %d ms. OutPipe: "%s" ErrorPipe: "%s"', [Waited, OutText, ErrorText]));
|
||||
end;
|
||||
|
||||
@ -1080,10 +1079,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
// Exit loop after 2s idletime when there was output earlier
|
||||
if (ReturnedSomethingAt > 0) and (Waited >= ReturnedSomethingAt+2000) then
|
||||
Break;
|
||||
|
||||
Application.ProcessMessages;
|
||||
end;
|
||||
rx.Free;
|
||||
|
Reference in New Issue
Block a user