forked from qt-creator/qt-creator
Get rid of SshConnectionInfo
It's not used anymore. Change-Id: Ie77c9d9bc8eb82c1f74cfdac2304bc6c2f92ee93 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -166,7 +166,6 @@ struct SshConnection::SshConnectionPrivate
|
||||
}
|
||||
|
||||
const SshConnectionParameters connParams;
|
||||
SshConnectionInfo connInfo;
|
||||
QtcProcess masterProcess;
|
||||
QString errorString;
|
||||
std::unique_ptr<QTemporaryDir> masterSocketDir;
|
||||
@@ -250,38 +249,6 @@ SshConnectionParameters SshConnection::connectionParameters() const
|
||||
return d->connParams;
|
||||
}
|
||||
|
||||
SshConnectionInfo SshConnection::connectionInfo() const
|
||||
{
|
||||
QTC_ASSERT(state() == Connected, return SshConnectionInfo());
|
||||
if (d->connInfo.isValid())
|
||||
return d->connInfo;
|
||||
QtcProcess p;
|
||||
const FilePath sshFilePath = SshSettings::sshFilePath();
|
||||
p.setCommand({sshFilePath, d->connectionArgs(sshFilePath) << "echo" << "-n" << "$SSH_CLIENT"});
|
||||
p.start();
|
||||
if (!p.waitForStarted() || !p.waitForFinished()) {
|
||||
qCWarning(Internal::sshLog) << "failed to retrieve connection info:" << p.errorString();
|
||||
return SshConnectionInfo();
|
||||
}
|
||||
const QByteArrayList data = p.readAllStandardOutput().split(' ');
|
||||
if (data.size() != 3) {
|
||||
qCWarning(Internal::sshLog) << "failed to retrieve connection info: unexpected output";
|
||||
return SshConnectionInfo();
|
||||
}
|
||||
d->connInfo.localPort = data.at(1).toInt();
|
||||
if (d->connInfo.localPort == 0) {
|
||||
qCWarning(Internal::sshLog) << "failed to retrieve connection info: unexpected output";
|
||||
return SshConnectionInfo();
|
||||
}
|
||||
if (!d->connInfo.localAddress.setAddress(QString::fromLatin1(data.first()))) {
|
||||
qCWarning(Internal::sshLog) << "failed to retrieve connection info: unexpected output";
|
||||
return SshConnectionInfo();
|
||||
}
|
||||
d->connInfo.peerPort = d->connParams.port();
|
||||
d->connInfo.peerAddress.setAddress(d->connParams.host());
|
||||
return d->connInfo;
|
||||
}
|
||||
|
||||
QStringList SshConnection::connectionOptions(const FilePath &binary) const
|
||||
{
|
||||
return d->connectionOptions(binary);
|
||||
|
@@ -78,21 +78,6 @@ public:
|
||||
QSSH_EXPORT bool operator==(const SshConnectionParameters &p1, const SshConnectionParameters &p2);
|
||||
QSSH_EXPORT bool operator!=(const SshConnectionParameters &p1, const SshConnectionParameters &p2);
|
||||
|
||||
class QSSH_EXPORT SshConnectionInfo
|
||||
{
|
||||
public:
|
||||
SshConnectionInfo() = default;
|
||||
SshConnectionInfo(const QHostAddress &la, quint16 lp, const QHostAddress &pa, quint16 pp)
|
||||
: localAddress(la), localPort(lp), peerAddress(pa), peerPort(pp) {}
|
||||
|
||||
bool isValid() const { return peerPort != 0; }
|
||||
|
||||
QHostAddress localAddress;
|
||||
quint16 localPort = 0;
|
||||
QHostAddress peerAddress;
|
||||
quint16 peerPort = 0;
|
||||
};
|
||||
|
||||
using SshRemoteProcessPtr = std::unique_ptr<SshRemoteProcess>;
|
||||
|
||||
class QSSH_EXPORT SshConnection : public QObject
|
||||
@@ -109,7 +94,6 @@ public:
|
||||
State state() const;
|
||||
QString errorString() const;
|
||||
SshConnectionParameters connectionParameters() const;
|
||||
SshConnectionInfo connectionInfo() const;
|
||||
QStringList connectionOptions(const Utils::FilePath &binary) const;
|
||||
bool sharingEnabled() const;
|
||||
~SshConnection();
|
||||
|
@@ -96,7 +96,6 @@ public:
|
||||
void disconnectFromHost();
|
||||
|
||||
QProcess::ProcessState state() const;
|
||||
SshConnectionInfo connectionInfo() const;
|
||||
QString socketFilePath() const
|
||||
{
|
||||
QTC_ASSERT(m_masterSocketDir, return QString());
|
||||
@@ -122,7 +121,6 @@ private:
|
||||
{ return connectionOptions(binary) << m_sshParameters.host(); }
|
||||
|
||||
const SshConnectionParameters m_sshParameters;
|
||||
mutable SshConnectionInfo m_connInfo;
|
||||
std::unique_ptr<QtcProcess> m_masterProcess;
|
||||
std::unique_ptr<QTemporaryDir> m_masterSocketDir;
|
||||
QTimer m_timer;
|
||||
@@ -240,38 +238,6 @@ QProcess::ProcessState SshSharedConnection::state() const
|
||||
return m_state;
|
||||
}
|
||||
|
||||
SshConnectionInfo SshSharedConnection::connectionInfo() const
|
||||
{
|
||||
QTC_ASSERT(state() == QProcess::Running, return SshConnectionInfo());
|
||||
if (m_connInfo.isValid())
|
||||
return m_connInfo;
|
||||
QtcProcess p;
|
||||
const FilePath sshFilePath = SshSettings::sshFilePath();
|
||||
p.setCommand({sshFilePath, connectionArgs(sshFilePath) << "echo" << "-n" << "$SSH_CLIENT"});
|
||||
p.start();
|
||||
if (!p.waitForStarted() || !p.waitForFinished()) {
|
||||
// qCWarning(Internal::sshLog) << "failed to retrieve connection info:" << p.errorString();
|
||||
return SshConnectionInfo();
|
||||
}
|
||||
const QByteArrayList data = p.readAllStandardOutput().split(' ');
|
||||
if (data.size() != 3) {
|
||||
// qCWarning(Internal::sshLog) << "failed to retrieve connection info: unexpected output";
|
||||
return SshConnectionInfo();
|
||||
}
|
||||
m_connInfo.localPort = data.at(1).toInt();
|
||||
if (m_connInfo.localPort == 0) {
|
||||
// qCWarning(Internal::sshLog) << "failed to retrieve connection info: unexpected output";
|
||||
return SshConnectionInfo();
|
||||
}
|
||||
if (!m_connInfo.localAddress.setAddress(QString::fromLatin1(data.first()))) {
|
||||
// qCWarning(Internal::sshLog) << "failed to retrieve connection info: unexpected output";
|
||||
return SshConnectionInfo();
|
||||
}
|
||||
m_connInfo.peerPort = m_sshParameters.port();
|
||||
m_connInfo.peerAddress.setAddress(m_sshParameters.host());
|
||||
return m_connInfo;
|
||||
}
|
||||
|
||||
void SshSharedConnection::emitConnected()
|
||||
{
|
||||
m_state = QProcess::Running;
|
||||
|
@@ -315,10 +315,6 @@ void tst_Ssh::sftp()
|
||||
SshConnection connection(params);
|
||||
QVERIFY(waitForConnection(connection));
|
||||
|
||||
const SshConnectionInfo connInfo = connection.connectionInfo();
|
||||
QVERIFY(connInfo.isValid());
|
||||
QCOMPARE(connInfo.peerPort, params.port());
|
||||
|
||||
// Create and upload 1000 small files and one big file
|
||||
QTemporaryDir dirForFilesToUpload;
|
||||
QTemporaryDir dirForFilesToDownload;
|
||||
|
Reference in New Issue
Block a user