SFtp: File transfer methods (String/Stream) are refactored. They can now take advantage of WhenProgress gate. Various fixes and refactoring.

git-svn-id: svn://ultimatepp.org/upp/trunk@12167 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
oblivion 2018-08-13 19:13:39 +00:00
commit 0ccf676f22
10 changed files with 89 additions and 91 deletions

View file

@ -42,7 +42,7 @@ bool SshChannel::Open()
{
if(IsOpen())
Close();
return Run([=]() mutable { return true; });
return Run([=]() mutable { return Init(); });
}
bool SshChannel::Close()
@ -193,8 +193,8 @@ String SshChannel::GetExitSignal()
INTERLOCKED
{
libssh2_channel_get_exit_signal(*channel, sig, &len, nullptr, nullptr, nullptr, nullptr);
s.Set(*sig, len);
}
s.Set(*sig, len);
LLOG("Exit signal: " << s);
return s;
}
@ -230,8 +230,10 @@ String SshChannel::GetLine(int maxlen, int sid)
if(line.GetLength() >= maxlen)
line = Null;
eol = c == '\n';
if(!eol)
if(!eol) {
line.Cat(c);
done++;
}
}
while(!eol && !IsEof() && !IsTimeout() && InProgress());
return eol || IsEof();