Maemo: Cache SSH connection in deployment step.

This commit is contained in:
qt-info@nokia.com
2010-08-12 18:06:58 +02:00
committed by ck
parent 415debe910
commit 54ecf82208

View File

@@ -301,22 +301,30 @@ void MaemoDeployStep::start()
#endif #endif
m_stopped = false; m_stopped = false;
// TODO: Re-use if possible (disconnect + reconnect).
if (m_connection)
disconnect(m_connection.data(), 0, this, 0);
m_connection = SshConnection::create();
const MaemoDeviceConfig &devConfig = deviceConfig(); const MaemoDeviceConfig &devConfig = deviceConfig();
if (!devConfig.isValid()) { if (!devConfig.isValid()) {
raiseError(tr("Deployment failed: No valid device set.")); raiseError(tr("Deployment failed: No valid device set."));
return; return;
} }
if (m_connection)
disconnect(m_connection.data(), 0, this, 0);
const bool canReUse = m_connection
&& m_connection->state() == SshConnection::Connected
&& m_connection->connectionParameters() == devConfig.server;
if (!canReUse)
m_connection = SshConnection::create();
connect(m_connection.data(), SIGNAL(connected()), this, connect(m_connection.data(), SIGNAL(connected()), this,
SLOT(handleConnected())); SLOT(handleConnected()));
connect(m_connection.data(), SIGNAL(error(SshError)), this, connect(m_connection.data(), SIGNAL(error(SshError)), this,
SLOT(handleConnectionFailure())); SLOT(handleConnectionFailure()));
m_connection->connectToHost(devConfig.server); if (canReUse) {
m_connecting = true; handleConnected();
} else {
writeOutput(tr("Connecting to device..."));
m_connecting = true;
m_connection->connectToHost(devConfig.server);
}
} }
void MaemoDeployStep::handleConnected() void MaemoDeployStep::handleConnected()