Modifications à SFTP suite aux essais à Angrignon
This commit is contained in:
@@ -32,6 +32,18 @@ int CSFTPServerManager::InitFTPServerManager(bool EnableSFTPClient, QString SFTP
|
||||
mTransferProcess = new QProcess(this);
|
||||
connect(mTransferProcess,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(ProcessFinished(int,QProcess::ExitStatus)));
|
||||
|
||||
QFile *PWDFile = new QFile("./password");
|
||||
if(PWDFile->open(QFile::ReadWrite | QFile::Truncate | QFile::Text | QFile::Unbuffered) == false)
|
||||
{
|
||||
qDebug("Imposible d'ouvrir le fichier password");
|
||||
PWDFile->close();
|
||||
delete PWDFile;
|
||||
}
|
||||
|
||||
PWDFile->write(qPrintable(SFTPPassword));
|
||||
PWDFile->close();
|
||||
delete PWDFile;
|
||||
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
@@ -97,7 +109,7 @@ int CSFTPServerManager::TransferTrainLogToSFTPServer(QString FileName, bool Dete
|
||||
SFTPBatchFile->close();
|
||||
delete SFTPBatchFile;
|
||||
|
||||
Cmd = QString ("sshpass -p \"%1\" sftp -oBatchMode=no -b ./sftpbatch %2@%3").arg(mSFTPPassword).arg(mSFTPLogin).arg(mSFTPServerAddress);
|
||||
Cmd = QString ("sshpass -f ./password sftp -oBatchMode=no -b ./sftpbatch %1@%2").arg(mSFTPLogin).arg(mSFTPServerAddress);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -124,7 +136,8 @@ void CSFTPServerManager::NewTrainFileSaved(QString Filename, bool Detection)
|
||||
void CSFTPServerManager::ProcessFinished(int ExitCode, QProcess::ExitStatus ExitStatus)
|
||||
{
|
||||
CEngLog::instance()->AddLogString(QString("Process SFTP terminé. Exit code: %1 || Exit status: %2 || Output: %3 || Erreur: %4 || stdout: %5").arg(ExitCode).arg(ExitStatus).arg(qPrintable(mTransferProcess->readAllStandardOutput())).arg(qPrintable(mTransferProcess->readAllStandardError())).arg(qPrintable(mTransferProcess->readAll())));
|
||||
// qDebug("stdout: %s",qPrintable(mTransferProcess->readAll()));
|
||||
mProcessTimer->stop();
|
||||
// qDebug("stdout: %s",qPrintable(mTransferProcess->readAll()));
|
||||
}
|
||||
|
||||
void CSFTPServerManager::ProcessTimerExpired()
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <QTimer>
|
||||
|
||||
//#define USE_SCP
|
||||
#define SFTP_PROCESS_TIMEOUT 2000 //millisecs
|
||||
#define SFTP_PROCESS_TIMEOUT 60000 //60s -- Le délai typique est de 45 secondes pour compléter le transfert.
|
||||
|
||||
class CSFTPServerManager : public QObject
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user