SSH: Log some more information for sftp sessions

Change-Id: I9065866920b964a32e9b5b6204a6e42bc15acdfe
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-06-18 13:52:39 +02:00
parent 60c2aae023
commit 39e3294a8c

View File

@@ -83,6 +83,8 @@ struct SftpSession::SftpSessionPrivate
SftpJobId queueCommand(CommandType command, const QStringList &paths) SftpJobId queueCommand(CommandType command, const QStringList &paths)
{ {
qCDebug(sshLog) << "queueing command" << int(command) << paths;
const SftpJobId jobId = nextJobId++; const SftpJobId jobId = nextJobId++;
pendingCommands.enqueue(Command(command, paths, jobId)); pendingCommands.enqueue(Command(command, paths, jobId));
runNextCommand(); runNextCommand();
@@ -111,6 +113,7 @@ SftpSession::SftpSession(const QStringList &connectionArgs) : d(new SftpSessionP
{ {
d->connectionArgs = connectionArgs; d->connectionArgs = connectionArgs;
connect(&d->sftpProc, &QProcess::started, [this] { connect(&d->sftpProc, &QProcess::started, [this] {
qCDebug(sshLog) << "sftp process started";
d->sftpProc.write("\n"); // Force initial prompt. d->sftpProc.write("\n"); // Force initial prompt.
}); });
connect(&d->sftpProc, &QProcess::errorOccurred, [this](QProcess::ProcessError error) { connect(&d->sftpProc, &QProcess::errorOccurred, [this](QProcess::ProcessError error) {
@@ -120,6 +123,8 @@ SftpSession::SftpSession(const QStringList &connectionArgs) : d(new SftpSessionP
} }
}); });
connect(&d->sftpProc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), [this] { connect(&d->sftpProc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), [this] {
qCDebug(sshLog) << "sftp process finished";
d->state = State::Inactive; d->state = State::Inactive;
if (d->sftpProc.exitStatus() != QProcess::NormalExit) { if (d->sftpProc.exitStatus() != QProcess::NormalExit) {
emit done(tr("sftp crashed.")); emit done(tr("sftp crashed."));
@@ -269,6 +274,8 @@ void SftpSession::start()
void SftpSession::quit() void SftpSession::quit()
{ {
qCDebug(sshLog) << "quitting sftp session, current state is" << int(state());
switch (state()) { switch (state()) {
case State::Starting: case State::Starting:
case State::Closing: case State::Closing: