forked from qt-creator/qt-creator
Maemo: Cache SSH connection in deployment step.
This commit is contained in:
@@ -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()
|
||||||
|
Reference in New Issue
Block a user