forked from qt-creator/qt-creator
SSH: Use plain pointers to SshConnection objects.
It used to be shared pointers so that existing connection objects could easily be passed around in order not to open a new connection to the same server. Since the introduction of the SshConnectionManager, this is no longer necessary. Change-Id: I13fd3eceaf35d562e6260e9969abbffb01edd6b5 Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -86,7 +86,7 @@ SftpDirNode *indexToDirNode(const QModelIndex &index)
|
|||||||
class SftpFileSystemModelPrivate
|
class SftpFileSystemModelPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SshConnection::Ptr sshConnection;
|
SshConnection *sshConnection;
|
||||||
SftpChannel::Ptr sftpChannel;
|
SftpChannel::Ptr sftpChannel;
|
||||||
QString rootDirectory;
|
QString rootDirectory;
|
||||||
SftpFileNode *rootNode;
|
SftpFileNode *rootNode;
|
||||||
@@ -101,6 +101,7 @@ using namespace Internal;
|
|||||||
SftpFileSystemModel::SftpFileSystemModel(QObject *parent)
|
SftpFileSystemModel::SftpFileSystemModel(QObject *parent)
|
||||||
: QAbstractItemModel(parent), d(new SftpFileSystemModelPrivate)
|
: QAbstractItemModel(parent), d(new SftpFileSystemModelPrivate)
|
||||||
{
|
{
|
||||||
|
d->sshConnection = 0;
|
||||||
d->rootDirectory = QLatin1String("/");
|
d->rootDirectory = QLatin1String("/");
|
||||||
d->rootNode = 0;
|
d->rootNode = 0;
|
||||||
d->statJobId = SftpInvalidJob;
|
d->statJobId = SftpInvalidJob;
|
||||||
@@ -116,13 +117,12 @@ void SftpFileSystemModel::setSshConnection(const SshConnectionParameters &sshPar
|
|||||||
{
|
{
|
||||||
QSSH_ASSERT_AND_RETURN(!d->sshConnection);
|
QSSH_ASSERT_AND_RETURN(!d->sshConnection);
|
||||||
d->sshConnection = SshConnectionManager::instance().acquireConnection(sshParams);
|
d->sshConnection = SshConnectionManager::instance().acquireConnection(sshParams);
|
||||||
connect(d->sshConnection.data(), SIGNAL(error(QSsh::SshError)),
|
connect(d->sshConnection, SIGNAL(error(QSsh::SshError)), SLOT(handleSshConnectionFailure()));
|
||||||
SLOT(handleSshConnectionFailure()));
|
|
||||||
if (d->sshConnection->state() == SshConnection::Connected) {
|
if (d->sshConnection->state() == SshConnection::Connected) {
|
||||||
handleSshConnectionEstablished();
|
handleSshConnectionEstablished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connect(d->sshConnection.data(), SIGNAL(connected()), SLOT(handleSshConnectionEstablished()));
|
connect(d->sshConnection, SIGNAL(connected()), SLOT(handleSshConnectionEstablished()));
|
||||||
if (d->sshConnection->state() == SshConnection::Unconnected)
|
if (d->sshConnection->state() == SshConnection::Unconnected)
|
||||||
d->sshConnection->connectToHost();
|
d->sshConnection->connectToHost();
|
||||||
}
|
}
|
||||||
@@ -269,9 +269,9 @@ void SftpFileSystemModel::shutDown()
|
|||||||
d->sftpChannel.clear();
|
d->sftpChannel.clear();
|
||||||
}
|
}
|
||||||
if (d->sshConnection) {
|
if (d->sshConnection) {
|
||||||
disconnect(d->sshConnection.data(), 0, this, 0);
|
disconnect(d->sshConnection, 0, this, 0);
|
||||||
SshConnectionManager::instance().releaseConnection(d->sshConnection);
|
SshConnectionManager::instance().releaseConnection(d->sshConnection);
|
||||||
d->sshConnection.clear();
|
d->sshConnection = 0;
|
||||||
}
|
}
|
||||||
delete d->rootNode;
|
delete d->rootNode;
|
||||||
d->rootNode = 0;
|
d->rootNode = 0;
|
||||||
|
@@ -107,12 +107,6 @@ bool operator!=(const SshConnectionParameters &p1, const SshConnectionParameters
|
|||||||
|
|
||||||
// TODO: Mechanism for checking the host key. First connection to host: save, later: compare
|
// TODO: Mechanism for checking the host key. First connection to host: save, later: compare
|
||||||
|
|
||||||
SshConnection::Ptr SshConnection::create(const SshConnectionParameters &serverInfo)
|
|
||||||
{
|
|
||||||
doStaticInitializationsIfNecessary();
|
|
||||||
return Ptr(new SshConnection(serverInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
SshConnection::SshConnection(const SshConnectionParameters &serverInfo)
|
SshConnection::SshConnection(const SshConnectionParameters &serverInfo)
|
||||||
: d(new Internal::SshConnectionPrivate(this, serverInfo))
|
: d(new Internal::SshConnectionPrivate(this, serverInfo))
|
||||||
{
|
{
|
||||||
@@ -208,6 +202,8 @@ SshConnectionPrivate::SshConnectionPrivate(SshConnection *conn,
|
|||||||
m_connParams(serverInfo), m_error(SshNoError), m_ignoreNextPacket(false),
|
m_connParams(serverInfo), m_error(SshNoError), m_ignoreNextPacket(false),
|
||||||
m_conn(conn)
|
m_conn(conn)
|
||||||
{
|
{
|
||||||
|
doStaticInitializationsIfNecessary();
|
||||||
|
|
||||||
setupPacketHandlers();
|
setupPacketHandlers();
|
||||||
m_socket->setProxy(m_connParams.proxyType == SshConnectionParameters::DefaultProxy
|
m_socket->setProxy(m_connParams.proxyType == SshConnectionParameters::DefaultProxy
|
||||||
? QNetworkProxy::DefaultProxy : QNetworkProxy::NoProxy);
|
? QNetworkProxy::DefaultProxy : QNetworkProxy::NoProxy);
|
||||||
|
@@ -90,9 +90,8 @@ class QSSH_EXPORT SshConnection : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
enum State { Unconnected, Connecting, Connected };
|
enum State { Unconnected, Connecting, Connected };
|
||||||
typedef QSharedPointer<SshConnection> Ptr;
|
|
||||||
|
|
||||||
static Ptr create(const SshConnectionParameters &serverInfo);
|
SshConnection(const SshConnectionParameters &serverInfo);
|
||||||
|
|
||||||
void connectToHost();
|
void connectToHost();
|
||||||
void disconnectFromHost();
|
void disconnectFromHost();
|
||||||
@@ -114,8 +113,6 @@ signals:
|
|||||||
void error(QSsh::SshError);
|
void error(QSsh::SshError);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SshConnection(const SshConnectionParameters &serverInfo);
|
|
||||||
|
|
||||||
Internal::SshConnectionPrivate *d;
|
Internal::SshConnectionPrivate *d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -62,12 +62,23 @@ public:
|
|||||||
moveToThread(QCoreApplication::instance()->thread());
|
moveToThread(QCoreApplication::instance()->thread());
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<SshConnection> acquireConnection(const SshConnectionParameters &sshParams)
|
~SshConnectionManagerPrivate()
|
||||||
|
{
|
||||||
|
foreach (SshConnection * const connection, m_unacquiredConnections) {
|
||||||
|
disconnect(connection, 0, this, 0);
|
||||||
|
delete connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSSH_ASSERT(m_acquiredConnections.isEmpty());
|
||||||
|
QSSH_ASSERT(m_deprecatedConnections.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
SshConnection *acquireConnection(const SshConnectionParameters &sshParams)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_listMutex);
|
QMutexLocker locker(&m_listMutex);
|
||||||
|
|
||||||
// Check in-use connections:
|
// Check in-use connections:
|
||||||
foreach (SshConnection::Ptr connection, m_acquiredConnections) {
|
foreach (SshConnection * const connection, m_acquiredConnections) {
|
||||||
if (connection->connectionParameters() != sshParams)
|
if (connection->connectionParameters() != sshParams)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -82,7 +93,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Checked cached open connections:
|
// Checked cached open connections:
|
||||||
foreach (SshConnection::Ptr connection, m_unacquiredConnections) {
|
foreach (SshConnection * const connection, m_unacquiredConnections) {
|
||||||
if (connection->state() != SshConnection::Connected
|
if (connection->state() != SshConnection::Connected
|
||||||
|| connection->connectionParameters() != sshParams)
|
|| connection->connectionParameters() != sshParams)
|
||||||
continue;
|
continue;
|
||||||
@@ -90,7 +101,7 @@ public:
|
|||||||
if (connection->thread() != QThread::currentThread()) {
|
if (connection->thread() != QThread::currentThread()) {
|
||||||
QMetaObject::invokeMethod(this, "switchToCallerThread",
|
QMetaObject::invokeMethod(this, "switchToCallerThread",
|
||||||
Qt::BlockingQueuedConnection,
|
Qt::BlockingQueuedConnection,
|
||||||
Q_ARG(SshConnection *, connection.data()),
|
Q_ARG(SshConnection *, connection),
|
||||||
Q_ARG(QObject *, QThread::currentThread()));
|
Q_ARG(QObject *, QThread::currentThread()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,27 +111,35 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create a new connection:
|
// create a new connection:
|
||||||
SshConnection::Ptr connection = SshConnection::create(sshParams);
|
SshConnection * const connection = new SshConnection(sshParams);
|
||||||
connect(connection.data(), SIGNAL(disconnected()), this, SLOT(cleanup()));
|
connect(connection, SIGNAL(disconnected()), this, SLOT(cleanup()));
|
||||||
m_acquiredConnections.append(connection);
|
m_acquiredConnections.append(connection);
|
||||||
|
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void releaseConnection(const SshConnection::Ptr &connection)
|
void releaseConnection(SshConnection *connection)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_listMutex);
|
QMutexLocker locker(&m_listMutex);
|
||||||
|
|
||||||
m_acquiredConnections.removeOne(connection);
|
const bool wasAquired = m_acquiredConnections.removeOne(connection);
|
||||||
if (!m_acquiredConnections.contains(connection)) {
|
QSSH_ASSERT_AND_RETURN(wasAquired);
|
||||||
// no longer in use:
|
if (m_acquiredConnections.contains(connection))
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool doDelete = false;
|
||||||
connection->moveToThread(QCoreApplication::instance()->thread());
|
connection->moveToThread(QCoreApplication::instance()->thread());
|
||||||
if (m_deprecatedConnections.contains(connection))
|
if (m_deprecatedConnections.removeOne(connection)
|
||||||
m_deprecatedConnections.removeAll(connection);
|
|| connection->state() != SshConnection::Connected) {
|
||||||
else if (connection->state() == SshConnection::Connected) {
|
doDelete = true;
|
||||||
// Make sure to only keep one connection open
|
} else {
|
||||||
|
QSSH_ASSERT_AND_RETURN(!m_unacquiredConnections.contains(connection));
|
||||||
|
|
||||||
|
// It can happen that two or more connections with the same parameters were acquired
|
||||||
|
// if the clients were running in different threads. Only keep one of them in
|
||||||
|
// such a case.
|
||||||
bool haveConnection = false;
|
bool haveConnection = false;
|
||||||
foreach (SshConnection::Ptr conn, m_unacquiredConnections) {
|
foreach (SshConnection * const conn, m_unacquiredConnections) {
|
||||||
if (conn->connectionParameters() == connection->connectionParameters()) {
|
if (conn->connectionParameters() == connection->connectionParameters()) {
|
||||||
haveConnection = true;
|
haveConnection = true;
|
||||||
break;
|
break;
|
||||||
@@ -128,7 +147,14 @@ public:
|
|||||||
}
|
}
|
||||||
if (!haveConnection)
|
if (!haveConnection)
|
||||||
m_unacquiredConnections.append(connection);
|
m_unacquiredConnections.append(connection);
|
||||||
|
else
|
||||||
|
doDelete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doDelete) {
|
||||||
|
disconnect(connection, 0, this, 0);
|
||||||
|
m_deprecatedConnections.removeAll(connection);
|
||||||
|
delete connection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,27 +162,24 @@ public:
|
|||||||
{
|
{
|
||||||
QMutexLocker locker(&m_listMutex);
|
QMutexLocker locker(&m_listMutex);
|
||||||
|
|
||||||
SshConnection::Ptr toReset;
|
for (int i = 0; i < m_unacquiredConnections.count(); ++i) {
|
||||||
foreach (SshConnection::Ptr connection, m_unacquiredConnections) {
|
SshConnection * const connection = m_unacquiredConnections.at(i);
|
||||||
if (connection->connectionParameters() == sshParams) {
|
if (connection->connectionParameters() == sshParams) {
|
||||||
toReset = connection;
|
disconnect(connection, 0, this, 0);
|
||||||
|
delete connection;
|
||||||
|
m_unacquiredConnections.removeAt(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toReset.isNull()) {
|
foreach (SshConnection * const connection, m_acquiredConnections) {
|
||||||
foreach (SshConnection::Ptr connection, m_acquiredConnections) {
|
|
||||||
if (connection->connectionParameters() == sshParams) {
|
if (connection->connectionParameters() == sshParams) {
|
||||||
toReset = connection;
|
if (!m_deprecatedConnections.contains(connection))
|
||||||
break;
|
m_deprecatedConnections.append(connection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!toReset.isNull() && !m_deprecatedConnections.contains(toReset))
|
|
||||||
m_deprecatedConnections.append(toReset);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_INVOKABLE void switchToCallerThread(SshConnection *connection, QObject *threadObj)
|
Q_INVOKABLE void switchToCallerThread(SshConnection *connection, QObject *threadObj)
|
||||||
{
|
{
|
||||||
@@ -172,9 +195,9 @@ private slots:
|
|||||||
if (!currentConnection)
|
if (!currentConnection)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i = m_unacquiredConnections.count() - 1; i >= 0; --i) {
|
if (m_unacquiredConnections.removeOne(currentConnection)) {
|
||||||
if (m_unacquiredConnections.at(i) == currentConnection)
|
disconnect(currentConnection, 0, this, 0);
|
||||||
m_unacquiredConnections.removeAt(i);
|
currentConnection->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,9 +205,12 @@ private:
|
|||||||
// We expect the number of concurrently open connections to be small.
|
// We expect the number of concurrently open connections to be small.
|
||||||
// If that turns out to not be the case, we can still use a data
|
// If that turns out to not be the case, we can still use a data
|
||||||
// structure with faster access.
|
// structure with faster access.
|
||||||
QList<SshConnection::Ptr> m_unacquiredConnections;
|
QList<SshConnection *> m_unacquiredConnections;
|
||||||
QList<SshConnection::Ptr> m_acquiredConnections;
|
|
||||||
QList<SshConnection::Ptr> m_deprecatedConnections;
|
// Can contain the same connection more than once; this acts as a reference count.
|
||||||
|
QList<SshConnection *> m_acquiredConnections;
|
||||||
|
|
||||||
|
QList<SshConnection *> m_deprecatedConnections;
|
||||||
QMutex m_listMutex;
|
QMutex m_listMutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -207,12 +233,12 @@ SshConnectionManager::~SshConnectionManager()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SshConnection::Ptr SshConnectionManager::acquireConnection(const SshConnectionParameters &sshParams)
|
SshConnection *SshConnectionManager::acquireConnection(const SshConnectionParameters &sshParams)
|
||||||
{
|
{
|
||||||
return d->acquireConnection(sshParams);
|
return d->acquireConnection(sshParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshConnectionManager::releaseConnection(const SshConnection::Ptr &connection)
|
void SshConnectionManager::releaseConnection(SshConnection *connection)
|
||||||
{
|
{
|
||||||
d->releaseConnection(connection);
|
d->releaseConnection(connection);
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,6 @@
|
|||||||
#include "ssh_global.h"
|
#include "ssh_global.h"
|
||||||
|
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
#include <QSharedPointer>
|
|
||||||
|
|
||||||
namespace QSsh {
|
namespace QSsh {
|
||||||
class SshConnection;
|
class SshConnection;
|
||||||
@@ -49,8 +48,8 @@ class QSSH_EXPORT SshConnectionManager
|
|||||||
public:
|
public:
|
||||||
static SshConnectionManager &instance();
|
static SshConnectionManager &instance();
|
||||||
|
|
||||||
QSharedPointer<SshConnection> acquireConnection(const SshConnectionParameters &sshParams);
|
SshConnection *acquireConnection(const SshConnectionParameters &sshParams);
|
||||||
void releaseConnection(const QSharedPointer<SshConnection> &connection);
|
void releaseConnection(SshConnection *connection);
|
||||||
// Make sure the next acquireConnection with the given parameters will return a new connection.
|
// Make sure the next acquireConnection with the given parameters will return a new connection.
|
||||||
void forceNewConnection(const SshConnectionParameters &sshParams);
|
void forceNewConnection(const SshConnectionParameters &sshParams);
|
||||||
|
|
||||||
|
@@ -54,7 +54,7 @@ public:
|
|||||||
SshRemoteProcessRunnerPrivate() : m_state(Inactive) {}
|
SshRemoteProcessRunnerPrivate() : m_state(Inactive) {}
|
||||||
|
|
||||||
SshRemoteProcess::Ptr m_process;
|
SshRemoteProcess::Ptr m_process;
|
||||||
SshConnection::Ptr m_connection;
|
SshConnection *m_connection;
|
||||||
bool m_runInTerminal;
|
bool m_runInTerminal;
|
||||||
SshPseudoTerminal m_terminal;
|
SshPseudoTerminal m_terminal;
|
||||||
QByteArray m_command;
|
QByteArray m_command;
|
||||||
@@ -112,13 +112,13 @@ void SshRemoteProcessRunner::runInternal(const QByteArray &command,
|
|||||||
d->m_exitCode = -1;
|
d->m_exitCode = -1;
|
||||||
d->m_command = command;
|
d->m_command = command;
|
||||||
d->m_connection = SshConnectionManager::instance().acquireConnection(sshParams);
|
d->m_connection = SshConnectionManager::instance().acquireConnection(sshParams);
|
||||||
connect(d->m_connection.data(), SIGNAL(error(QSsh::SshError)),
|
connect(d->m_connection, SIGNAL(error(QSsh::SshError)),
|
||||||
SLOT(handleConnectionError(QSsh::SshError)));
|
SLOT(handleConnectionError(QSsh::SshError)));
|
||||||
connect(d->m_connection.data(), SIGNAL(disconnected()), SLOT(handleDisconnected()));
|
connect(d->m_connection, SIGNAL(disconnected()), SLOT(handleDisconnected()));
|
||||||
if (d->m_connection->state() == SshConnection::Connected) {
|
if (d->m_connection->state() == SshConnection::Connected) {
|
||||||
handleConnected();
|
handleConnected();
|
||||||
} else {
|
} else {
|
||||||
connect(d->m_connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
|
connect(d->m_connection, SIGNAL(connected()), SLOT(handleConnected()));
|
||||||
if (d->m_connection->state() == SshConnection::Unconnected)
|
if (d->m_connection->state() == SshConnection::Unconnected)
|
||||||
d->m_connection->connectToHost();
|
d->m_connection->connectToHost();
|
||||||
}
|
}
|
||||||
@@ -208,9 +208,9 @@ void SshRemoteProcessRunner::setState(int newState)
|
|||||||
d->m_process.clear();
|
d->m_process.clear();
|
||||||
}
|
}
|
||||||
if (d->m_connection) {
|
if (d->m_connection) {
|
||||||
disconnect(d->m_connection.data(), 0, this, 0);
|
disconnect(d->m_connection, 0, this, 0);
|
||||||
SshConnectionManager::instance().releaseConnection(d->m_connection);
|
SshConnectionManager::instance().releaseConnection(d->m_connection);
|
||||||
d->m_connection.clear();
|
d->m_connection = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,7 @@ namespace Internal {
|
|||||||
|
|
||||||
RemoteGdbProcess::RemoteGdbProcess(const QSsh::SshConnectionParameters &connParams,
|
RemoteGdbProcess::RemoteGdbProcess(const QSsh::SshConnectionParameters &connParams,
|
||||||
RemotePlainGdbAdapter *adapter, QObject *parent)
|
RemotePlainGdbAdapter *adapter, QObject *parent)
|
||||||
: AbstractGdbProcess(parent), m_connParams(connParams),
|
: AbstractGdbProcess(parent), m_connParams(connParams), m_conn(0),
|
||||||
m_state(Inactive), m_adapter(adapter)
|
m_state(Inactive), m_adapter(adapter)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -93,12 +93,11 @@ void RemoteGdbProcess::realStart(const QString &cmd, const QStringList &args,
|
|||||||
m_errorOutput.clear();
|
m_errorOutput.clear();
|
||||||
m_inputToSend.clear();
|
m_inputToSend.clear();
|
||||||
m_conn = SshConnectionManager::instance().acquireConnection(m_connParams);
|
m_conn = SshConnectionManager::instance().acquireConnection(m_connParams);
|
||||||
connect(m_conn.data(), SIGNAL(error(QSsh::SshError)), this,
|
connect(m_conn, SIGNAL(error(QSsh::SshError)), this, SLOT(handleConnectionError()));
|
||||||
SLOT(handleConnectionError()));
|
|
||||||
if (m_conn->state() == SshConnection::Connected) {
|
if (m_conn->state() == SshConnection::Connected) {
|
||||||
handleConnected();
|
handleConnected();
|
||||||
} else {
|
} else {
|
||||||
connect(m_conn.data(), SIGNAL(connected()), this, SLOT(handleConnected()));
|
connect(m_conn, SIGNAL(connected()), this, SLOT(handleConnected()));
|
||||||
if (m_conn->state() == SshConnection::Unconnected)
|
if (m_conn->state() == SshConnection::Unconnected)
|
||||||
m_conn->connectToHost();
|
m_conn->connectToHost();
|
||||||
}
|
}
|
||||||
@@ -397,9 +396,9 @@ void RemoteGdbProcess::setState(State newState)
|
|||||||
disconnect(m_fifoCreator.data(), 0, this, 0);
|
disconnect(m_fifoCreator.data(), 0, this, 0);
|
||||||
m_fifoCreator = QSsh::SshRemoteProcess::Ptr();
|
m_fifoCreator = QSsh::SshRemoteProcess::Ptr();
|
||||||
}
|
}
|
||||||
disconnect(m_conn.data(), 0, this, 0);
|
disconnect(m_conn, 0, this, 0);
|
||||||
SshConnectionManager::instance().releaseConnection(m_conn);
|
SshConnectionManager::instance().releaseConnection(m_conn);
|
||||||
m_conn.clear();
|
m_conn = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -107,7 +107,7 @@ private:
|
|||||||
void setState(State newState);
|
void setState(State newState);
|
||||||
|
|
||||||
QSsh::SshConnectionParameters m_connParams;
|
QSsh::SshConnectionParameters m_connParams;
|
||||||
QSsh::SshConnection::Ptr m_conn;
|
QSsh::SshConnection *m_conn;
|
||||||
QSsh::SshRemoteProcess::Ptr m_gdbProc;
|
QSsh::SshRemoteProcess::Ptr m_gdbProc;
|
||||||
QSsh::SshRemoteProcess::Ptr m_appOutputReader;
|
QSsh::SshRemoteProcess::Ptr m_appOutputReader;
|
||||||
QSsh::SshRemoteProcess::Ptr m_fifoCreator;
|
QSsh::SshRemoteProcess::Ptr m_fifoCreator;
|
||||||
|
@@ -128,7 +128,7 @@ void MaddeDeviceTester::handleGenericTestFinished(TestResult result)
|
|||||||
m_stdout.clear();
|
m_stdout.clear();
|
||||||
m_stderr.clear();
|
m_stderr.clear();
|
||||||
m_state = QtTest;
|
m_state = QtTest;
|
||||||
m_processRunner->run(qtInfoCmd.toUtf8(), m_genericTester->connection()->connectionParameters());
|
m_processRunner->run(qtInfoCmd.toUtf8(), m_deviceConfiguration->sshParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaddeDeviceTester::handleConnectionError()
|
void MaddeDeviceTester::handleConnectionError()
|
||||||
@@ -196,7 +196,7 @@ void MaddeDeviceTester::handleQtTestFinished(int exitStatus)
|
|||||||
emit progressMessage(tr("Checking for connectivity support..."));
|
emit progressMessage(tr("Checking for connectivity support..."));
|
||||||
m_state = MadDeveloperTest;
|
m_state = MadDeveloperTest;
|
||||||
m_processRunner->run(QString(QLatin1String("test -x") + MaemoGlobal::devrootshPath()).toUtf8(),
|
m_processRunner->run(QString(QLatin1String("test -x") + MaemoGlobal::devrootshPath()).toUtf8(),
|
||||||
m_genericTester->connection()->connectionParameters());
|
m_deviceConfiguration->sshParameters());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaddeDeviceTester::handleMadDeveloperTestFinished(int exitStatus)
|
void MaddeDeviceTester::handleMadDeveloperTestFinished(int exitStatus)
|
||||||
@@ -233,8 +233,7 @@ void MaddeDeviceTester::handleMadDeveloperTestFinished(int exitStatus)
|
|||||||
emit progressMessage(tr("Checking for QML tooling support..."));
|
emit progressMessage(tr("Checking for QML tooling support..."));
|
||||||
m_state = QmlToolingTest;
|
m_state = QmlToolingTest;
|
||||||
m_processRunner->run(QString(QLatin1String("test -d ")
|
m_processRunner->run(QString(QLatin1String("test -d ")
|
||||||
+ QLatin1String(QmlToolingDirectory)).toUtf8(),
|
+ QLatin1String(QmlToolingDirectory)).toUtf8(), m_deviceConfiguration->sshParameters());
|
||||||
m_genericTester->connection()->connectionParameters());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaddeDeviceTester::handleQmlToolingTestFinished(int exitStatus)
|
void MaddeDeviceTester::handleQmlToolingTestFinished(int exitStatus)
|
||||||
|
@@ -70,7 +70,7 @@ MaemoDeploymentMounter::MaemoDeploymentMounter(QObject *parent)
|
|||||||
|
|
||||||
MaemoDeploymentMounter::~MaemoDeploymentMounter() {}
|
MaemoDeploymentMounter::~MaemoDeploymentMounter() {}
|
||||||
|
|
||||||
void MaemoDeploymentMounter::setupMounts(const SshConnection::Ptr &connection,
|
void MaemoDeploymentMounter::setupMounts(SshConnection *connection,
|
||||||
const LinuxDeviceConfiguration::ConstPtr &devConf,
|
const LinuxDeviceConfiguration::ConstPtr &devConf,
|
||||||
const QList<MaemoMountSpecification> &mountSpecs,
|
const QList<MaemoMountSpecification> &mountSpecs,
|
||||||
const Qt4BuildConfiguration *bc)
|
const Qt4BuildConfiguration *bc)
|
||||||
@@ -82,8 +82,7 @@ void MaemoDeploymentMounter::setupMounts(const SshConnection::Ptr &connection,
|
|||||||
m_devConf = devConf;
|
m_devConf = devConf;
|
||||||
m_mounter->setConnection(m_connection, m_devConf);
|
m_mounter->setConnection(m_connection, m_devConf);
|
||||||
m_buildConfig = bc;
|
m_buildConfig = bc;
|
||||||
connect(m_connection.data(), SIGNAL(error(QSsh::SshError)),
|
connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionError()));
|
||||||
SLOT(handleConnectionError()));
|
|
||||||
setState(UnmountingOldDirs);
|
setState(UnmountingOldDirs);
|
||||||
unmount();
|
unmount();
|
||||||
}
|
}
|
||||||
@@ -205,8 +204,8 @@ void MaemoDeploymentMounter::setState(State newState)
|
|||||||
if (m_state == newState)
|
if (m_state == newState)
|
||||||
return;
|
return;
|
||||||
if (newState == Inactive && m_connection) {
|
if (newState == Inactive && m_connection) {
|
||||||
disconnect(m_connection.data(), 0, this, 0);
|
disconnect(m_connection, 0, this, 0);
|
||||||
m_connection.clear();
|
m_connection = 0;
|
||||||
}
|
}
|
||||||
m_state = newState;
|
m_state = newState;
|
||||||
}
|
}
|
||||||
|
@@ -61,7 +61,7 @@ public:
|
|||||||
~MaemoDeploymentMounter();
|
~MaemoDeploymentMounter();
|
||||||
|
|
||||||
// Connection must be in connected state.
|
// Connection must be in connected state.
|
||||||
void setupMounts(const QSharedPointer<QSsh::SshConnection> &connection,
|
void setupMounts(QSsh::SshConnection *connection,
|
||||||
const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &devConf,
|
const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &devConf,
|
||||||
const QList<MaemoMountSpecification> &mountSpecs,
|
const QList<MaemoMountSpecification> &mountSpecs,
|
||||||
const Qt4ProjectManager::Qt4BuildConfiguration *bc);
|
const Qt4ProjectManager::Qt4BuildConfiguration *bc);
|
||||||
@@ -93,7 +93,7 @@ private:
|
|||||||
void setState(State newState);
|
void setState(State newState);
|
||||||
|
|
||||||
State m_state;
|
State m_state;
|
||||||
QSharedPointer<QSsh::SshConnection> m_connection;
|
QSsh::SshConnection *m_connection;
|
||||||
QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> m_devConf;
|
QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> m_devConf;
|
||||||
MaemoRemoteMounter * const m_mounter;
|
MaemoRemoteMounter * const m_mounter;
|
||||||
RemoteLinux::RemoteLinuxUsedPortsGatherer * const m_portsGatherer;
|
RemoteLinux::RemoteLinuxUsedPortsGatherer * const m_portsGatherer;
|
||||||
|
@@ -52,7 +52,7 @@ MaemoRemoteCopyFacility::MaemoRemoteCopyFacility(QObject *parent) :
|
|||||||
|
|
||||||
MaemoRemoteCopyFacility::~MaemoRemoteCopyFacility() {}
|
MaemoRemoteCopyFacility::~MaemoRemoteCopyFacility() {}
|
||||||
|
|
||||||
void MaemoRemoteCopyFacility::copyFiles(const SshConnection::Ptr &connection,
|
void MaemoRemoteCopyFacility::copyFiles(SshConnection *connection,
|
||||||
const LinuxDeviceConfiguration::ConstPtr &devConf,
|
const LinuxDeviceConfiguration::ConstPtr &devConf,
|
||||||
const QList<DeployableFile> &deployables, const QString &mountPoint)
|
const QList<DeployableFile> &deployables, const QString &mountPoint)
|
||||||
{
|
{
|
||||||
|
@@ -59,7 +59,7 @@ public:
|
|||||||
explicit MaemoRemoteCopyFacility(QObject *parent = 0);
|
explicit MaemoRemoteCopyFacility(QObject *parent = 0);
|
||||||
~MaemoRemoteCopyFacility();
|
~MaemoRemoteCopyFacility();
|
||||||
|
|
||||||
void copyFiles(const QSharedPointer<QSsh::SshConnection> &connection,
|
void copyFiles(QSsh::SshConnection *connection,
|
||||||
const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &devConf,
|
const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &devConf,
|
||||||
const QList<RemoteLinux::DeployableFile> &deployables, const QString &mountPoint);
|
const QList<RemoteLinux::DeployableFile> &deployables, const QString &mountPoint);
|
||||||
void cancel();
|
void cancel();
|
||||||
|
@@ -66,7 +66,7 @@ MaemoRemoteMounter::~MaemoRemoteMounter()
|
|||||||
killAllUtfsServers();
|
killAllUtfsServers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoRemoteMounter::setConnection(const SshConnection::Ptr &connection,
|
void MaemoRemoteMounter::setConnection(SshConnection *connection,
|
||||||
const LinuxDeviceConfiguration::ConstPtr &devConf)
|
const LinuxDeviceConfiguration::ConstPtr &devConf)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_state == Inactive, return);
|
QTC_ASSERT(m_state == Inactive, return);
|
||||||
|
@@ -68,7 +68,7 @@ public:
|
|||||||
~MaemoRemoteMounter();
|
~MaemoRemoteMounter();
|
||||||
|
|
||||||
// Must already be connected.
|
// Must already be connected.
|
||||||
void setConnection(const QSharedPointer<QSsh::SshConnection> &connection,
|
void setConnection(QSsh::SshConnection *connection,
|
||||||
const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &devConf);
|
const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &devConf);
|
||||||
|
|
||||||
void setBuildConfiguration(const Qt4ProjectManager::Qt4BuildConfiguration *bc);
|
void setBuildConfiguration(const Qt4ProjectManager::Qt4BuildConfiguration *bc);
|
||||||
@@ -123,7 +123,7 @@ private:
|
|||||||
int remotePort;
|
int remotePort;
|
||||||
};
|
};
|
||||||
|
|
||||||
QSharedPointer<QSsh::SshConnection> m_connection;
|
QSsh::SshConnection *m_connection;
|
||||||
QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> m_devConf;
|
QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> m_devConf;
|
||||||
QList<MountInfo> m_mountSpecs;
|
QList<MountInfo> m_mountSpecs;
|
||||||
QSharedPointer<QSsh::SshRemoteProcess> m_mountProcess;
|
QSharedPointer<QSsh::SshRemoteProcess> m_mountProcess;
|
||||||
|
@@ -83,11 +83,12 @@ const char LastDeployedTimesKey[] = "Qt4ProjectManager.MaemoRunConfiguration.Las
|
|||||||
class AbstractRemoteLinuxDeployServicePrivate
|
class AbstractRemoteLinuxDeployServicePrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AbstractRemoteLinuxDeployServicePrivate() : state(Inactive), stopRequested(false) {}
|
AbstractRemoteLinuxDeployServicePrivate()
|
||||||
|
: connection(0), state(Inactive), stopRequested(false) {}
|
||||||
|
|
||||||
LinuxDeviceConfiguration::ConstPtr deviceConfiguration;
|
LinuxDeviceConfiguration::ConstPtr deviceConfiguration;
|
||||||
QPointer<Qt4BuildConfiguration> buildConfiguration;
|
QPointer<Qt4BuildConfiguration> buildConfiguration;
|
||||||
SshConnection::Ptr connection;
|
SshConnection *connection;
|
||||||
State state;
|
State state;
|
||||||
bool stopRequested;
|
bool stopRequested;
|
||||||
|
|
||||||
@@ -117,7 +118,7 @@ LinuxDeviceConfiguration::ConstPtr AbstractRemoteLinuxDeployService::deviceConfi
|
|||||||
return d->deviceConfiguration;
|
return d->deviceConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
SshConnection::Ptr AbstractRemoteLinuxDeployService::connection() const
|
SshConnection *AbstractRemoteLinuxDeployService::connection() const
|
||||||
{
|
{
|
||||||
return d->connection;
|
return d->connection;
|
||||||
}
|
}
|
||||||
@@ -263,12 +264,12 @@ void AbstractRemoteLinuxDeployService::handleDeviceSetupDone(bool success)
|
|||||||
|
|
||||||
d->state = Connecting;
|
d->state = Connecting;
|
||||||
d->connection = SshConnectionManager::instance().acquireConnection(d->deviceConfiguration->sshParameters());
|
d->connection = SshConnectionManager::instance().acquireConnection(d->deviceConfiguration->sshParameters());
|
||||||
connect(d->connection.data(), SIGNAL(error(QSsh::SshError)),
|
connect(d->connection, SIGNAL(error(QSsh::SshError)),
|
||||||
SLOT(handleConnectionFailure()));
|
SLOT(handleConnectionFailure()));
|
||||||
if (d->connection->state() == SshConnection::Connected) {
|
if (d->connection->state() == SshConnection::Connected) {
|
||||||
handleConnected();
|
handleConnected();
|
||||||
} else {
|
} else {
|
||||||
connect(d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
|
connect(d->connection, SIGNAL(connected()), SLOT(handleConnected()));
|
||||||
emit progressMessage(tr("Connecting to device..."));
|
emit progressMessage(tr("Connecting to device..."));
|
||||||
if (d->connection->state() == SshConnection::Unconnected)
|
if (d->connection->state() == SshConnection::Unconnected)
|
||||||
d->connection->connectToHost();
|
d->connection->connectToHost();
|
||||||
@@ -322,9 +323,9 @@ void AbstractRemoteLinuxDeployService::setFinished()
|
|||||||
{
|
{
|
||||||
d->state = Inactive;
|
d->state = Inactive;
|
||||||
if (d->connection) {
|
if (d->connection) {
|
||||||
disconnect(d->connection.data(), 0, this, 0);
|
disconnect(d->connection, 0, this, 0);
|
||||||
SshConnectionManager::instance().releaseConnection(d->connection);
|
SshConnectionManager::instance().releaseConnection(d->connection);
|
||||||
d->connection = SshConnection::Ptr();
|
d->connection = 0;
|
||||||
}
|
}
|
||||||
d->stopRequested = false;
|
d->stopRequested = false;
|
||||||
emit finished();
|
emit finished();
|
||||||
|
@@ -82,7 +82,7 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
const Qt4ProjectManager::Qt4BuildConfiguration *qt4BuildConfiguration() const;
|
const Qt4ProjectManager::Qt4BuildConfiguration *qt4BuildConfiguration() const;
|
||||||
QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration() const;
|
QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration() const;
|
||||||
QSharedPointer<QSsh::SshConnection> connection() const;
|
QSsh::SshConnection *connection() const;
|
||||||
|
|
||||||
void saveDeploymentTimeStamp(const DeployableFile &deployableFile);
|
void saveDeploymentTimeStamp(const DeployableFile &deployableFile);
|
||||||
bool hasChangedSinceLastDeployment(const DeployableFile &deployableFile) const;
|
bool hasChangedSinceLastDeployment(const DeployableFile &deployableFile) const;
|
||||||
|
@@ -51,10 +51,10 @@ enum State { Inactive, Connecting, RunningUname, TestingPorts };
|
|||||||
class GenericLinuxDeviceTesterPrivate
|
class GenericLinuxDeviceTesterPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GenericLinuxDeviceTesterPrivate() : state(Inactive) {}
|
GenericLinuxDeviceTesterPrivate() : connection(0), state(Inactive) {}
|
||||||
|
|
||||||
LinuxDeviceConfiguration::ConstPtr deviceConfiguration;
|
LinuxDeviceConfiguration::ConstPtr deviceConfiguration;
|
||||||
SshConnection::Ptr connection;
|
SshConnection *connection;
|
||||||
SshRemoteProcess::Ptr process;
|
SshRemoteProcess::Ptr process;
|
||||||
RemoteLinuxUsedPortsGatherer portsGatherer;
|
RemoteLinuxUsedPortsGatherer portsGatherer;
|
||||||
State state;
|
State state;
|
||||||
@@ -76,6 +76,7 @@ GenericLinuxDeviceTester::GenericLinuxDeviceTester(QObject *parent)
|
|||||||
|
|
||||||
GenericLinuxDeviceTester::~GenericLinuxDeviceTester()
|
GenericLinuxDeviceTester::~GenericLinuxDeviceTester()
|
||||||
{
|
{
|
||||||
|
delete d->connection;
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,9 +85,9 @@ void GenericLinuxDeviceTester::testDevice(const LinuxDeviceConfiguration::ConstP
|
|||||||
QTC_ASSERT(d->state == Inactive, return);
|
QTC_ASSERT(d->state == Inactive, return);
|
||||||
|
|
||||||
d->deviceConfiguration = deviceConfiguration;
|
d->deviceConfiguration = deviceConfiguration;
|
||||||
d->connection = SshConnection::create(deviceConfiguration->sshParameters());
|
d->connection = new SshConnection(deviceConfiguration->sshParameters());
|
||||||
connect(d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
|
connect(d->connection, SIGNAL(connected()), SLOT(handleConnected()));
|
||||||
connect(d->connection.data(), SIGNAL(error(QSsh::SshError)),
|
connect(d->connection, SIGNAL(error(QSsh::SshError)),
|
||||||
SLOT(handleConnectionFailure()));
|
SLOT(handleConnectionFailure()));
|
||||||
|
|
||||||
emit progressMessage(tr("Connecting to host..."));
|
emit progressMessage(tr("Connecting to host..."));
|
||||||
@@ -115,11 +116,6 @@ void GenericLinuxDeviceTester::stopTest()
|
|||||||
setFinished(TestFailure);
|
setFinished(TestFailure);
|
||||||
}
|
}
|
||||||
|
|
||||||
SshConnection::Ptr GenericLinuxDeviceTester::connection() const
|
|
||||||
{
|
|
||||||
return d->connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GenericLinuxDeviceTester::handleConnected()
|
void GenericLinuxDeviceTester::handleConnected()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->state == Connecting, return);
|
QTC_ASSERT(d->state == Connecting, return);
|
||||||
@@ -190,8 +186,10 @@ void GenericLinuxDeviceTester::handlePortListReady()
|
|||||||
void GenericLinuxDeviceTester::setFinished(TestResult result)
|
void GenericLinuxDeviceTester::setFinished(TestResult result)
|
||||||
{
|
{
|
||||||
d->state = Inactive;
|
d->state = Inactive;
|
||||||
disconnect(d->connection.data(), 0, this, 0);
|
disconnect(d->connection, 0, this, 0);
|
||||||
disconnect(&d->portsGatherer, 0, this, 0);
|
disconnect(&d->portsGatherer, 0, this, 0);
|
||||||
|
delete d->connection;
|
||||||
|
d->connection = 0;
|
||||||
emit finished(result);
|
emit finished(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -80,8 +80,6 @@ public:
|
|||||||
void testDevice(const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfiguration);
|
void testDevice(const QSharedPointer<const LinuxDeviceConfiguration> &deviceConfiguration);
|
||||||
void stopTest();
|
void stopTest();
|
||||||
|
|
||||||
QSharedPointer<QSsh::SshConnection> connection() const;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleConnected();
|
void handleConnected();
|
||||||
void handleConnectionFailure();
|
void handleConnectionFailure();
|
||||||
|
@@ -42,7 +42,7 @@ namespace RemoteLinux {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
PackageUploader::PackageUploader(QObject *parent) :
|
PackageUploader::PackageUploader(QObject *parent) :
|
||||||
QObject(parent), m_state(Inactive)
|
QObject(parent), m_state(Inactive), m_connection(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ PackageUploader::~PackageUploader()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackageUploader::uploadPackage(const SshConnection::Ptr &connection,
|
void PackageUploader::uploadPackage(SshConnection *connection,
|
||||||
const QString &localFilePath, const QString &remoteFilePath)
|
const QString &localFilePath, const QString &remoteFilePath)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_state == Inactive, return);
|
QTC_ASSERT(m_state == Inactive, return);
|
||||||
@@ -61,8 +61,7 @@ void PackageUploader::uploadPackage(const SshConnection::Ptr &connection,
|
|||||||
m_localFilePath = localFilePath;
|
m_localFilePath = localFilePath;
|
||||||
m_remoteFilePath = remoteFilePath;
|
m_remoteFilePath = remoteFilePath;
|
||||||
m_connection = connection;
|
m_connection = connection;
|
||||||
connect(m_connection.data(), SIGNAL(error(QSsh::SshError)),
|
connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionFailure()));
|
||||||
SLOT(handleConnectionFailure()));
|
|
||||||
m_uploader = m_connection->createSftpChannel();
|
m_uploader = m_connection->createSftpChannel();
|
||||||
connect(m_uploader.data(), SIGNAL(initialized()), this,
|
connect(m_uploader.data(), SIGNAL(initialized()), this,
|
||||||
SLOT(handleSftpChannelInitialized()));
|
SLOT(handleSftpChannelInitialized()));
|
||||||
@@ -149,8 +148,8 @@ void PackageUploader::setState(State newState)
|
|||||||
m_uploader.clear();
|
m_uploader.clear();
|
||||||
}
|
}
|
||||||
if (m_connection) {
|
if (m_connection) {
|
||||||
disconnect(m_connection.data(), 0, this, 0);
|
disconnect(m_connection, 0, this, 0);
|
||||||
m_connection.clear();
|
m_connection = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_state = newState;
|
m_state = newState;
|
||||||
|
@@ -55,7 +55,7 @@ public:
|
|||||||
~PackageUploader();
|
~PackageUploader();
|
||||||
|
|
||||||
// Connection has to be established already.
|
// Connection has to be established already.
|
||||||
void uploadPackage(const QSharedPointer<QSsh::SshConnection> &connection,
|
void uploadPackage(QSsh::SshConnection *connection,
|
||||||
const QString &localFilePath, const QString &remoteFilePath);
|
const QString &localFilePath, const QString &remoteFilePath);
|
||||||
void cancelUpload();
|
void cancelUpload();
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ private:
|
|||||||
void setState(State newState);
|
void setState(State newState);
|
||||||
|
|
||||||
State m_state;
|
State m_state;
|
||||||
QSharedPointer<QSsh::SshConnection> m_connection;
|
QSsh::SshConnection *m_connection;
|
||||||
QSharedPointer<QSsh::SftpChannel> m_uploader;
|
QSharedPointer<QSsh::SftpChannel> m_uploader;
|
||||||
QString m_localFilePath;
|
QString m_localFilePath;
|
||||||
QString m_remoteFilePath;
|
QString m_remoteFilePath;
|
||||||
|
@@ -68,6 +68,7 @@ public:
|
|||||||
appArguments(runConfig->arguments()),
|
appArguments(runConfig->arguments()),
|
||||||
commandPrefix(runConfig->commandPrefix()),
|
commandPrefix(runConfig->commandPrefix()),
|
||||||
initialFreePorts(runConfig->freePorts()),
|
initialFreePorts(runConfig->freePorts()),
|
||||||
|
connection(0),
|
||||||
stopRequested(false),
|
stopRequested(false),
|
||||||
state(Inactive)
|
state(Inactive)
|
||||||
{
|
{
|
||||||
@@ -80,7 +81,7 @@ public:
|
|||||||
const QString commandPrefix;
|
const QString commandPrefix;
|
||||||
const PortList initialFreePorts;
|
const PortList initialFreePorts;
|
||||||
|
|
||||||
QSsh::SshConnection::Ptr connection;
|
QSsh::SshConnection *connection;
|
||||||
QSsh::SshRemoteProcess::Ptr runner;
|
QSsh::SshRemoteProcess::Ptr runner;
|
||||||
QSsh::SshRemoteProcess::Ptr cleaner;
|
QSsh::SshRemoteProcess::Ptr cleaner;
|
||||||
|
|
||||||
@@ -108,7 +109,7 @@ AbstractRemoteLinuxApplicationRunner::~AbstractRemoteLinuxApplicationRunner()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
SshConnection::Ptr AbstractRemoteLinuxApplicationRunner::connection() const
|
SshConnection *AbstractRemoteLinuxApplicationRunner::connection() const
|
||||||
{
|
{
|
||||||
return d->connection;
|
return d->connection;
|
||||||
}
|
}
|
||||||
@@ -310,9 +311,9 @@ void AbstractRemoteLinuxApplicationRunner::setInactive()
|
|||||||
{
|
{
|
||||||
d->portsGatherer.stop();
|
d->portsGatherer.stop();
|
||||||
if (d->connection) {
|
if (d->connection) {
|
||||||
disconnect(d->connection.data(), 0, this, 0);
|
disconnect(d->connection, 0, this, 0);
|
||||||
SshConnectionManager::instance().releaseConnection(d->connection);
|
SshConnectionManager::instance().releaseConnection(d->connection);
|
||||||
d->connection = SshConnection::Ptr();
|
d->connection = 0;
|
||||||
}
|
}
|
||||||
if (d->cleaner)
|
if (d->cleaner)
|
||||||
disconnect(d->cleaner.data(), 0, this, 0);
|
disconnect(d->cleaner.data(), 0, this, 0);
|
||||||
@@ -400,8 +401,8 @@ void AbstractRemoteLinuxApplicationRunner::handleDeviceSetupDone(bool success)
|
|||||||
d->state = Connecting;
|
d->state = Connecting;
|
||||||
d->exitStatus = -1;
|
d->exitStatus = -1;
|
||||||
d->freePorts = d->initialFreePorts;
|
d->freePorts = d->initialFreePorts;
|
||||||
connect(d->connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
|
connect(d->connection, SIGNAL(connected()), SLOT(handleConnected()));
|
||||||
connect(d->connection.data(), SIGNAL(error(QSsh::SshError)),
|
connect(d->connection, SIGNAL(error(QSsh::SshError)),
|
||||||
SLOT(handleConnectionFailure()));
|
SLOT(handleConnectionFailure()));
|
||||||
if (d->connection->state() == SshConnection::Connected) {
|
if (d->connection->state() == SshConnection::Connected) {
|
||||||
handleConnected();
|
handleConnected();
|
||||||
|
@@ -62,8 +62,8 @@ public:
|
|||||||
|
|
||||||
void startExecution(const QByteArray &remoteCall);
|
void startExecution(const QByteArray &remoteCall);
|
||||||
|
|
||||||
QSharedPointer<QSsh::SshConnection> connection() const;
|
|
||||||
QSharedPointer<const LinuxDeviceConfiguration> devConfig() const;
|
QSharedPointer<const LinuxDeviceConfiguration> devConfig() const;
|
||||||
|
QSsh::SshConnection *connection() const;
|
||||||
const RemoteLinuxUsedPortsGatherer *usedPortsGatherer() const;
|
const RemoteLinuxUsedPortsGatherer *usedPortsGatherer() const;
|
||||||
Utils::PortList *freePorts();
|
Utils::PortList *freePorts();
|
||||||
QString remoteExecutable() const;
|
QString remoteExecutable() const;
|
||||||
|
@@ -49,7 +49,7 @@ namespace Internal {
|
|||||||
class RemoteLinuxUsedPortsGathererPrivate
|
class RemoteLinuxUsedPortsGathererPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SshConnection::Ptr connection;
|
SshConnection *connection;
|
||||||
SshRemoteProcess::Ptr process;
|
SshRemoteProcess::Ptr process;
|
||||||
PortList portsToCheck;
|
PortList portsToCheck;
|
||||||
QList<int> usedPorts;
|
QList<int> usedPorts;
|
||||||
@@ -64,6 +64,7 @@ using namespace Internal;
|
|||||||
RemoteLinuxUsedPortsGatherer::RemoteLinuxUsedPortsGatherer(QObject *parent) :
|
RemoteLinuxUsedPortsGatherer::RemoteLinuxUsedPortsGatherer(QObject *parent) :
|
||||||
QObject(parent), d(new RemoteLinuxUsedPortsGathererPrivate)
|
QObject(parent), d(new RemoteLinuxUsedPortsGathererPrivate)
|
||||||
{
|
{
|
||||||
|
d->connection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteLinuxUsedPortsGatherer::~RemoteLinuxUsedPortsGatherer()
|
RemoteLinuxUsedPortsGatherer::~RemoteLinuxUsedPortsGatherer()
|
||||||
@@ -76,12 +77,12 @@ void RemoteLinuxUsedPortsGatherer::start(const LinuxDeviceConfiguration::ConstPt
|
|||||||
QTC_ASSERT(!d->connection, return);
|
QTC_ASSERT(!d->connection, return);
|
||||||
d->portsToCheck = devConf->freePorts();
|
d->portsToCheck = devConf->freePorts();
|
||||||
d->connection = SshConnectionManager::instance().acquireConnection(devConf->sshParameters());
|
d->connection = SshConnectionManager::instance().acquireConnection(devConf->sshParameters());
|
||||||
connect(d->connection.data(), SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionError()));
|
connect(d->connection, SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionError()));
|
||||||
if (d->connection->state() == SshConnection::Connected) {
|
if (d->connection->state() == SshConnection::Connected) {
|
||||||
handleConnectionEstablished();
|
handleConnectionEstablished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
connect(d->connection.data(), SIGNAL(connected()), SLOT(handleConnectionEstablished()));
|
connect(d->connection, SIGNAL(connected()), SLOT(handleConnectionEstablished()));
|
||||||
if (d->connection->state() == SshConnection::Unconnected)
|
if (d->connection->state() == SshConnection::Unconnected)
|
||||||
d->connection->connectToHost();
|
d->connection->connectToHost();
|
||||||
}
|
}
|
||||||
@@ -119,9 +120,9 @@ void RemoteLinuxUsedPortsGatherer::stop()
|
|||||||
if (d->process)
|
if (d->process)
|
||||||
disconnect(d->process.data(), 0, this, 0);
|
disconnect(d->process.data(), 0, this, 0);
|
||||||
d->process.clear();
|
d->process.clear();
|
||||||
disconnect(d->connection.data(), 0, this, 0);
|
disconnect(d->connection, 0, this, 0);
|
||||||
SshConnectionManager::instance().releaseConnection(d->connection);
|
SshConnectionManager::instance().releaseConnection(d->connection);
|
||||||
d->connection.clear();
|
d->connection = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RemoteLinuxUsedPortsGatherer::getNextFreePort(PortList *freePorts) const
|
int RemoteLinuxUsedPortsGatherer::getNextFreePort(PortList *freePorts) const
|
||||||
|
@@ -102,7 +102,7 @@ private:
|
|||||||
Option m_lastOption;
|
Option m_lastOption;
|
||||||
|
|
||||||
// remote callgrind support
|
// remote callgrind support
|
||||||
QSsh::SshConnection::Ptr m_ssh;
|
QSsh::SshConnection *m_ssh;
|
||||||
QString m_tempDataFile;
|
QString m_tempDataFile;
|
||||||
QSsh::SshRemoteProcess::Ptr m_findRemoteFile;
|
QSsh::SshRemoteProcess::Ptr m_findRemoteFile;
|
||||||
QSsh::SftpChannel::Ptr m_sftp;
|
QSsh::SftpChannel::Ptr m_sftp;
|
||||||
|
@@ -152,11 +152,12 @@ RemoteValgrindProcess::RemoteValgrindProcess(const QSsh::SshConnectionParameters
|
|||||||
QObject *parent)
|
QObject *parent)
|
||||||
: ValgrindProcess(parent)
|
: ValgrindProcess(parent)
|
||||||
, m_params(sshParams)
|
, m_params(sshParams)
|
||||||
|
, m_connection(0)
|
||||||
, m_error(QProcess::UnknownError)
|
, m_error(QProcess::UnknownError)
|
||||||
, m_pid(0)
|
, m_pid(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
RemoteValgrindProcess::RemoteValgrindProcess(const QSsh::SshConnection::Ptr &connection, QObject *parent)
|
RemoteValgrindProcess::RemoteValgrindProcess(QSsh::SshConnection *connection, QObject *parent)
|
||||||
: ValgrindProcess(parent)
|
: ValgrindProcess(parent)
|
||||||
, m_params(connection->connectionParameters())
|
, m_params(connection->connectionParameters())
|
||||||
, m_connection(connection)
|
, m_connection(connection)
|
||||||
@@ -164,6 +165,11 @@ RemoteValgrindProcess::RemoteValgrindProcess(const QSsh::SshConnection::Ptr &con
|
|||||||
, m_pid(0)
|
, m_pid(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
RemoteValgrindProcess::~RemoteValgrindProcess()
|
||||||
|
{
|
||||||
|
delete m_connection;
|
||||||
|
}
|
||||||
|
|
||||||
bool RemoteValgrindProcess::isRunning() const
|
bool RemoteValgrindProcess::isRunning() const
|
||||||
{
|
{
|
||||||
return m_process && m_process->isRunning();
|
return m_process && m_process->isRunning();
|
||||||
@@ -179,12 +185,11 @@ void RemoteValgrindProcess::run(const QString &valgrindExecutable, const QString
|
|||||||
|
|
||||||
// connect to host and wait for connection
|
// connect to host and wait for connection
|
||||||
if (!m_connection)
|
if (!m_connection)
|
||||||
m_connection = QSsh::SshConnection::create(m_params);
|
m_connection = new QSsh::SshConnection(m_params);
|
||||||
|
|
||||||
if (m_connection->state() != QSsh::SshConnection::Connected) {
|
if (m_connection->state() != QSsh::SshConnection::Connected) {
|
||||||
connect(m_connection.data(), SIGNAL(connected()),
|
connect(m_connection, SIGNAL(connected()), this, SLOT(connected()));
|
||||||
this, SLOT(connected()));
|
connect(m_connection, SIGNAL(error(QSsh::SshError)),
|
||||||
connect(m_connection.data(), SIGNAL(error(QSsh::SshError)),
|
|
||||||
this, SLOT(error(QSsh::SshError)));
|
this, SLOT(error(QSsh::SshError)));
|
||||||
if (m_connection->state() == QSsh::SshConnection::Unconnected)
|
if (m_connection->state() == QSsh::SshConnection::Unconnected)
|
||||||
m_connection->connectToHost();
|
m_connection->connectToHost();
|
||||||
@@ -219,7 +224,7 @@ void RemoteValgrindProcess::connected()
|
|||||||
m_process->start();
|
m_process->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSsh::SshConnection::Ptr RemoteValgrindProcess::connection() const
|
QSsh::SshConnection *RemoteValgrindProcess::connection() const
|
||||||
{
|
{
|
||||||
return m_connection;
|
return m_connection;
|
||||||
}
|
}
|
||||||
|
@@ -120,8 +120,9 @@ class RemoteValgrindProcess : public ValgrindProcess
|
|||||||
public:
|
public:
|
||||||
explicit RemoteValgrindProcess(const QSsh::SshConnectionParameters &sshParams,
|
explicit RemoteValgrindProcess(const QSsh::SshConnectionParameters &sshParams,
|
||||||
QObject *parent = 0);
|
QObject *parent = 0);
|
||||||
explicit RemoteValgrindProcess(const QSsh::SshConnection::Ptr &connection,
|
explicit RemoteValgrindProcess(QSsh::SshConnection *connection,
|
||||||
QObject *parent = 0);
|
QObject *parent = 0);
|
||||||
|
~RemoteValgrindProcess();
|
||||||
|
|
||||||
virtual bool isRunning() const;
|
virtual bool isRunning() const;
|
||||||
|
|
||||||
@@ -139,7 +140,7 @@ public:
|
|||||||
|
|
||||||
virtual qint64 pid() const;
|
virtual qint64 pid() const;
|
||||||
|
|
||||||
QSsh::SshConnection::Ptr connection() const;
|
QSsh::SshConnection *connection() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void closed(int);
|
void closed(int);
|
||||||
@@ -152,7 +153,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QSsh::SshConnectionParameters m_params;
|
QSsh::SshConnectionParameters m_params;
|
||||||
QSsh::SshConnection::Ptr m_connection;
|
QSsh::SshConnection *m_connection;
|
||||||
QSsh::SshRemoteProcess::Ptr m_process;
|
QSsh::SshRemoteProcess::Ptr m_process;
|
||||||
QString m_workingDir;
|
QString m_workingDir;
|
||||||
QString m_valgrindExe;
|
QString m_valgrindExe;
|
||||||
|
@@ -48,7 +48,7 @@ public:
|
|||||||
Test()
|
Test()
|
||||||
{
|
{
|
||||||
m_timeoutTimer.setSingleShot(true);
|
m_timeoutTimer.setSingleShot(true);
|
||||||
m_connection = SshConnection::create(SshConnectionParameters());
|
m_connection = new SshConnection(SshConnectionParameters());
|
||||||
if (m_connection->state() != SshConnection::Unconnected) {
|
if (m_connection->state() != SshConnection::Unconnected) {
|
||||||
qDebug("Error: Newly created SSH connection has state %d.",
|
qDebug("Error: Newly created SSH connection has state %d.",
|
||||||
m_connection->state());
|
m_connection->state());
|
||||||
@@ -107,7 +107,10 @@ public:
|
|||||||
runNextTest();
|
runNextTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
~Test();
|
~Test()
|
||||||
|
{
|
||||||
|
delete m_connection;
|
||||||
|
}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleConnected()
|
void handleConnected()
|
||||||
@@ -164,17 +167,15 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void runNextTest()
|
void runNextTest()
|
||||||
{
|
{
|
||||||
if (m_connection)
|
if (m_connection) {
|
||||||
disconnect(m_connection.data(), 0, this, 0);
|
disconnect(m_connection, 0, this, 0);
|
||||||
m_connection = SshConnection::create(m_testSet.first().params);
|
delete m_connection;
|
||||||
connect(m_connection.data(), SIGNAL(connected()), this,
|
}
|
||||||
SLOT(handleConnected()));
|
m_connection = new SshConnection(m_testSet.first().params);
|
||||||
connect(m_connection.data(), SIGNAL(disconnected()), this,
|
connect(m_connection, SIGNAL(connected()), SLOT(handleConnected()));
|
||||||
SLOT(handleDisconnected()));
|
connect(m_connection, SIGNAL(disconnected()), SLOT(handleDisconnected()));
|
||||||
connect(m_connection.data(), SIGNAL(dataAvailable(QString)), this,
|
connect(m_connection, SIGNAL(dataAvailable(QString)), SLOT(handleDataAvailable(QString)));
|
||||||
SLOT(handleDataAvailable(QString)));
|
connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleError(QSsh::SshError)));
|
||||||
connect(m_connection.data(), SIGNAL(error(QSsh::SshError)), this,
|
|
||||||
SLOT(handleError(QSsh::SshError)));
|
|
||||||
const TestItem &nextItem = m_testSet.first();
|
const TestItem &nextItem = m_testSet.first();
|
||||||
m_timeoutTimer.stop();
|
m_timeoutTimer.stop();
|
||||||
m_timeoutTimer.setInterval(qMax(10000, nextItem.params.timeout * 1000));
|
m_timeoutTimer.setInterval(qMax(10000, nextItem.params.timeout * 1000));
|
||||||
@@ -182,7 +183,7 @@ private:
|
|||||||
m_connection->connectToHost();
|
m_connection->connectToHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
SshConnection::Ptr m_connection;
|
SshConnection *m_connection;
|
||||||
typedef QList<SshError> ErrorList;
|
typedef QList<SshError> ErrorList;
|
||||||
struct TestItem {
|
struct TestItem {
|
||||||
TestItem(const char *d, const SshConnectionParameters &p,
|
TestItem(const char *d, const SshConnectionParameters &p,
|
||||||
@@ -196,8 +197,6 @@ private:
|
|||||||
QTimer m_timeoutTimer;
|
QTimer m_timeoutTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
Test::~Test() {}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QCoreApplication a(argc, argv);
|
QCoreApplication a(argc, argv);
|
||||||
|
@@ -47,6 +47,7 @@ const QByteArray StderrOutput("ChannelTest");
|
|||||||
RemoteProcessTest::RemoteProcessTest(const SshConnectionParameters ¶ms)
|
RemoteProcessTest::RemoteProcessTest(const SshConnectionParameters ¶ms)
|
||||||
: m_sshParams(params),
|
: m_sshParams(params),
|
||||||
m_timeoutTimer(new QTimer(this)),
|
m_timeoutTimer(new QTimer(this)),
|
||||||
|
m_sshConnection(0),
|
||||||
m_remoteRunner(new SshRemoteProcessRunner(this)),
|
m_remoteRunner(new SshRemoteProcessRunner(this)),
|
||||||
m_state(Inactive)
|
m_state(Inactive)
|
||||||
{
|
{
|
||||||
@@ -54,7 +55,10 @@ RemoteProcessTest::RemoteProcessTest(const SshConnectionParameters ¶ms)
|
|||||||
connect(m_timeoutTimer, SIGNAL(timeout()), SLOT(handleTimeout()));
|
connect(m_timeoutTimer, SIGNAL(timeout()), SLOT(handleTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteProcessTest::~RemoteProcessTest() { }
|
RemoteProcessTest::~RemoteProcessTest()
|
||||||
|
{
|
||||||
|
delete m_sshConnection;
|
||||||
|
}
|
||||||
|
|
||||||
void RemoteProcessTest::run()
|
void RemoteProcessTest::run()
|
||||||
{
|
{
|
||||||
@@ -214,9 +218,9 @@ void RemoteProcessTest::handleProcessClosed(int exitStatus)
|
|||||||
}
|
}
|
||||||
std::cout << "Ok.\nTesting I/O device functionality... " << std::flush;
|
std::cout << "Ok.\nTesting I/O device functionality... " << std::flush;
|
||||||
m_state = TestingIoDevice;
|
m_state = TestingIoDevice;
|
||||||
m_sshConnection = QSsh::SshConnection::create(m_sshParams);
|
m_sshConnection = new QSsh::SshConnection(m_sshParams);
|
||||||
connect(m_sshConnection.data(), SIGNAL(connected()), SLOT(handleConnected()));
|
connect(m_sshConnection, SIGNAL(connected()), SLOT(handleConnected()));
|
||||||
connect(m_sshConnection.data(), SIGNAL(error(QSsh::SshError)),
|
connect(m_sshConnection, SIGNAL(error(QSsh::SshError)),
|
||||||
SLOT(handleConnectionError()));
|
SLOT(handleConnectionError()));
|
||||||
m_sshConnection->connectToHost();
|
m_sshConnection->connectToHost();
|
||||||
m_timeoutTimer->start();
|
m_timeoutTimer->start();
|
||||||
|
@@ -76,7 +76,7 @@ private:
|
|||||||
QSsh::SshRemoteProcessRunner * const m_remoteRunner;
|
QSsh::SshRemoteProcessRunner * const m_remoteRunner;
|
||||||
QSsh::SshRemoteProcess::Ptr m_catProcess;
|
QSsh::SshRemoteProcess::Ptr m_catProcess;
|
||||||
QSsh::SshRemoteProcess::Ptr m_echoProcess;
|
QSsh::SshRemoteProcess::Ptr m_echoProcess;
|
||||||
QSsh::SshConnection::Ptr m_sshConnection;
|
QSsh::SshConnection *m_sshConnection;
|
||||||
QByteArray m_remoteStdout;
|
QByteArray m_remoteStdout;
|
||||||
QByteArray m_remoteStderr;
|
QByteArray m_remoteStderr;
|
||||||
QByteArray m_remoteData;
|
QByteArray m_remoteData;
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
using namespace QSsh;
|
using namespace QSsh;
|
||||||
|
|
||||||
SftpTest::SftpTest(const Parameters ¶ms)
|
SftpTest::SftpTest(const Parameters ¶ms)
|
||||||
: m_parameters(params), m_state(Inactive), m_error(false),
|
: m_parameters(params), m_state(Inactive), m_error(false), m_connection(0),
|
||||||
m_bigFileUploadJob(SftpInvalidJob),
|
m_bigFileUploadJob(SftpInvalidJob),
|
||||||
m_bigFileDownloadJob(SftpInvalidJob),
|
m_bigFileDownloadJob(SftpInvalidJob),
|
||||||
m_bigFileRemovalJob(SftpInvalidJob),
|
m_bigFileRemovalJob(SftpInvalidJob),
|
||||||
@@ -57,17 +57,15 @@ SftpTest::SftpTest(const Parameters ¶ms)
|
|||||||
SftpTest::~SftpTest()
|
SftpTest::~SftpTest()
|
||||||
{
|
{
|
||||||
removeFiles(true);
|
removeFiles(true);
|
||||||
|
delete m_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SftpTest::run()
|
void SftpTest::run()
|
||||||
{
|
{
|
||||||
m_connection = SshConnection::create(m_parameters.sshParams);
|
m_connection = new SshConnection(m_parameters.sshParams);
|
||||||
connect(m_connection.data(), SIGNAL(connected()), this,
|
connect(m_connection, SIGNAL(connected()), SLOT(handleConnected()));
|
||||||
SLOT(handleConnected()));
|
connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleError()));
|
||||||
connect(m_connection.data(), SIGNAL(error(QSsh::SshError)), this,
|
connect(m_connection, SIGNAL(disconnected()), SLOT(handleDisconnected()));
|
||||||
SLOT(handleError()));
|
|
||||||
connect(m_connection.data(), SIGNAL(disconnected()), this,
|
|
||||||
SLOT(handleDisconnected()));
|
|
||||||
std::cout << "Connecting to host '"
|
std::cout << "Connecting to host '"
|
||||||
<< qPrintable(m_parameters.sshParams.host) << "'..." << std::endl;
|
<< qPrintable(m_parameters.sshParams.host) << "'..." << std::endl;
|
||||||
m_state = Connecting;
|
m_state = Connecting;
|
||||||
|
@@ -90,7 +90,7 @@ private:
|
|||||||
const Parameters m_parameters;
|
const Parameters m_parameters;
|
||||||
State m_state;
|
State m_state;
|
||||||
bool m_error;
|
bool m_error;
|
||||||
QSsh::SshConnection::Ptr m_connection;
|
QSsh::SshConnection *m_connection;
|
||||||
QSsh::SftpChannel::Ptr m_channel;
|
QSsh::SftpChannel::Ptr m_channel;
|
||||||
QList<FilePtr> m_localSmallFiles;
|
QList<FilePtr> m_localSmallFiles;
|
||||||
JobMap m_smallFilesUploadJobs;
|
JobMap m_smallFilesUploadJobs;
|
||||||
|
@@ -45,16 +45,17 @@ using namespace QSsh;
|
|||||||
|
|
||||||
Shell::Shell(const QSsh::SshConnectionParameters ¶meters, QObject *parent)
|
Shell::Shell(const QSsh::SshConnectionParameters ¶meters, QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
m_connection(SshConnection::create(parameters)),
|
m_connection(new SshConnection(parameters)),
|
||||||
m_stdin(new QFile(this))
|
m_stdin(new QFile(this))
|
||||||
{
|
{
|
||||||
connect(m_connection.data(), SIGNAL(connected()), SLOT(handleConnected()));
|
connect(m_connection, SIGNAL(connected()), SLOT(handleConnected()));
|
||||||
connect(m_connection.data(), SIGNAL(dataAvailable(QString)), SLOT(handleShellMessage(QString)));
|
connect(m_connection, SIGNAL(dataAvailable(QString)), SLOT(handleShellMessage(QString)));
|
||||||
connect(m_connection.data(), SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionError()));
|
connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionError()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Shell::~Shell()
|
Shell::~Shell()
|
||||||
{
|
{
|
||||||
|
delete m_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shell::run()
|
void Shell::run()
|
||||||
|
@@ -67,7 +67,7 @@ private slots:
|
|||||||
void handleStdin();
|
void handleStdin();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedPointer<QSsh::SshConnection> m_connection;
|
QSsh::SshConnection *m_connection;
|
||||||
QSharedPointer<QSsh::SshRemoteProcess> m_shell;
|
QSharedPointer<QSsh::SshRemoteProcess> m_shell;
|
||||||
QFile * const m_stdin;
|
QFile * const m_stdin;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user