Commit b76af11d authored by Kimmo Ollila's avatar Kimmo Ollila Committed by Eike Ziller

Fix 'SFTP upload hangs' issue with Dropbear

This happens at least on Boot2Qt devices with Dropbear SSH.
Handling readChannelFinished() signal fixes the issue.

Task-number: QTCREATORBUG-16158
Change-Id: I7c6660ce3a1bfe6eeb868da5a818c0b92307eda0
Reviewed-by: Christian Kandeler's avatarChristian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent a8230eb6
......@@ -191,6 +191,8 @@ void GenericDirectUploadService::handleUploadFinished(SftpJobId jobId, const QSt
this, &GenericDirectUploadService::handleStdOutData);
connect(d->chmodProc.data(), &SshRemoteProcess::readyReadStandardError,
this, &GenericDirectUploadService::handleStdErrData);
connect(d->chmodProc.data(), &SshRemoteProcess::readChannelFinished,
this, &GenericDirectUploadService::handleReadChannelFinished);
d->chmodProc->start();
} else {
uploadNextFile();
......@@ -275,6 +277,8 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus)
this, &GenericDirectUploadService::handleStdOutData);
connect(d->lnProc.data(), &SshRemoteProcess::readyReadStandardError,
this, &GenericDirectUploadService::handleStdErrData);
connect(d->lnProc.data(), &SshRemoteProcess::readChannelFinished,
this, &GenericDirectUploadService::handleReadChannelFinished);
d->lnProc->start();
} else {
const SftpJobId job = d->uploader->uploadFile(df.localFilePath().toString(),
......@@ -310,6 +314,13 @@ void GenericDirectUploadService::handleStdErrData()
emit stdErrData(QString::fromUtf8(process->readAllStandardError()));
}
void GenericDirectUploadService::handleReadChannelFinished()
{
SshRemoteProcess * const process = qobject_cast<SshRemoteProcess *>(sender());
if (process && process->atEnd())
process->close();
}
void GenericDirectUploadService::stopDeployment()
{
QTC_ASSERT(d->state == InitializingSftp || d->state == Uploading, setFinished(); return);
......@@ -383,6 +394,8 @@ void GenericDirectUploadService::uploadNextFile()
this, &GenericDirectUploadService::handleStdOutData);
connect(d->mkdirProc.data(), &SshRemoteProcess::readyReadStandardError,
this, &GenericDirectUploadService::handleStdErrData);
connect(d->mkdirProc.data(), &SshRemoteProcess::readChannelFinished,
this, &GenericDirectUploadService::handleReadChannelFinished);
emit progressMessage(tr("Uploading file \"%1\"...")
.arg(df.localFilePath().toUserOutput()));
d->mkdirProc->start();
......
......@@ -68,6 +68,7 @@ private:
void handleChmodFinished(int exitStatus);
void handleStdOutData();
void handleStdErrData();
void handleReadChannelFinished();
void checkDeploymentNeeded(const ProjectExplorer::DeployableFile &file) const;
void setFinished();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment