Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeepAlive doesn't work in FAR 3 distributions since 2021 #329

Closed
emuzychenko opened this issue Jul 25, 2023 · 2 comments
Closed

KeepAlive doesn't work in FAR 3 distributions since 2021 #329

emuzychenko opened this issue Jul 25, 2023 · 2 comments

Comments

@emuzychenko
Copy link

Since 2021, KeepAlive doesn't work in SSH connection in plugin versions supplied in FAR distribution. The log at level Debug 2 contains no KeepAlive records for both methods (null packets and dummy actions).

I found FAR 3.0.5588.1545 (2020) where both methods of KeepAlive works normally, the related records are logged.

@rohitab
Copy link

rohitab commented Jul 28, 2023

Please see FarGroup/FarManager#713 and my comment FarGroup/FarManager#713 (comment).

I believe this issue is due to the same reason, i.e. the FE_IDLE event and the DN_ENTERIDLE message were removed in FarGroup/FarManager@7af0fd7, and keep-alive messages depend on it. Due to the changes in the commit, the Idle() methods will not be called, and as you can in the code below, these methods are responsible for keeping the connection alive.

void TSFTPFileSystem::Idle()
{
// Keep session alive
if ((GetSessionData()->GetPingType() != ptOff) &&
((Now() - FSecureShell->GetLastDataSent()) > GetSessionData()->GetPingIntervalDT()))
{
if ((GetSessionData()->GetPingType() == ptDummyCommand) &&
FSecureShell->GetReady())
{
FTerminal->LogEvent("Sending dummy command to keep session alive.");
TSFTPPacket Packet(SSH_FXP_REALPATH, FCodePage);
Packet.AddPathString(ROOTDIRECTORY, FUtfStrings);
SendPacketAndReceiveResponse(&Packet, &Packet);
}
else
{
FSecureShell->KeepAlive();
}
}
FSecureShell->Idle();
}

void TSCPFileSystem::Idle()
{
// Keep session alive
const TSessionData *Data = FTerminal->GetSessionData();
if ((Data->GetPingType() != ptOff) &&
(Now() - FSecureShell->GetLastDataSent() > Data->GetPingIntervalDT()))
{
if ((Data->GetPingType() == ptDummyCommand) &&
FSecureShell->GetReady())
{
if (!FProcessingCommand)
{
ExecCommand(fsNull, 0);
}
else
{
FTerminal->LogEvent("Cannot send keepalive, command is being executed");
// send at least SSH-level keepalive, if nothing else, it at least updates
// LastDataSent, no the next keepalive attempt is postponed
FSecureShell->KeepAlive();
}
}
else
{
FSecureShell->KeepAlive();
}
}
FSecureShell->Idle();
}

void TFTPFileSystem::Idle()
{
if (FActive && !FWaitingForReply)
{
PoolForFatalNonCommandReply();
// Keep session alive
if ((FTerminal->GetSessionData()->GetFtpPingType() != ptOff) &&
((Now() - FLastDataSent).GetValue() > FTerminal->GetSessionData()->GetFtpPingIntervalDT().GetValue() * 4))
{
FTerminal->LogEvent("Dummy directory read to keep session alive.");
FLastDataSent = Now(); // probably redundant to the same statement in DoReadDirectory
DummyReadDirectory(RemoteGetCurrentDirectory());
}
}
}

@michaellukashov
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants