summaryrefslogtreecommitdiff
path: root/src/libs
diff options
context:
space:
mode:
authorhjk <hjk121@nokiamail.com>2014-11-26 15:29:42 +0100
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2014-11-27 12:44:29 +0100
commit3431a24feef17cae173590558f83cc5775210197 (patch)
tree1bd0d1e6a78261bf3575b2a7dd44d49e9957c589 /src/libs
parent13c7d1c2ce5eb426f17d190e78188f196fcb29dc (diff)
downloadqt-creator-3431a24feef17cae173590558f83cc5775210197.tar.gz
Ssh: Remove indirection in AbstractSshChannel::m_timeoutTimer
... and connect it using Qt5-style connects. Change-Id: Ic7f36949b38d4773f5ac0f04853abf93bebcf467 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/ssh/sshchannel.cpp14
-rw-r--r--src/libs/ssh/sshchannel_p.h5
-rw-r--r--src/libs/ssh/sshdirecttcpiptunnel.cpp2
-rw-r--r--src/libs/ssh/sshremoteprocess.cpp6
4 files changed, 13 insertions, 14 deletions
diff --git a/src/libs/ssh/sshchannel.cpp b/src/libs/ssh/sshchannel.cpp
index 269cee765b..453812b928 100644
--- a/src/libs/ssh/sshchannel.cpp
+++ b/src/libs/ssh/sshchannel.cpp
@@ -48,13 +48,13 @@ const quint32 NoChannel = 0xffffffffu;
AbstractSshChannel::AbstractSshChannel(quint32 channelId,
SshSendFacility &sendFacility)
- : m_sendFacility(sendFacility), m_timeoutTimer(new QTimer(this)),
+ : m_sendFacility(sendFacility),
m_localChannel(channelId), m_remoteChannel(NoChannel),
m_localWindowSize(initialWindowSize()), m_remoteWindowSize(0),
m_state(Inactive)
{
- m_timeoutTimer->setSingleShot(true);
- connect(m_timeoutTimer, SIGNAL(timeout()), this, SIGNAL(timeout()));
+ m_timeoutTimer.setSingleShot(true);
+ connect(&m_timeoutTimer, &QTimer::timeout, this, &AbstractSshChannel::timeout);
}
AbstractSshChannel::~AbstractSshChannel()
@@ -78,7 +78,7 @@ void AbstractSshChannel::requestSessionStart()
try {
m_sendFacility.sendSessionPacket(m_localChannel, initialWindowSize(), maxPacketSize());
setChannelState(SessionRequested);
- m_timeoutTimer->start(ReplyTimeout);
+ m_timeoutTimer.start(ReplyTimeout);
} catch (Botan::Exception &e) {
qDebug("Botan error: %s", e.what());
closeChannel();
@@ -147,7 +147,7 @@ void AbstractSshChannel::handleOpenSuccess(quint32 remoteChannelId,
"Unexpected SSH_MSG_CHANNEL_OPEN_CONFIRMATION packet.");
}
- m_timeoutTimer->stop();
+ m_timeoutTimer.stop();
if (remoteMaxPacketSize < MinMaxPacketSize) {
throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
@@ -178,7 +178,7 @@ void AbstractSshChannel::handleOpenFailure(const QString &reason)
"Unexpected SSH_MSG_CHANNEL_OPEN_CONFIRMATION packet.");
}
- m_timeoutTimer->stop();
+ m_timeoutTimer.stop();
#ifdef CREATOR_SSH_DEBUG
qDebug("Channel open request failed for channel %u", m_localChannel);
@@ -254,7 +254,7 @@ int AbstractSshChannel::handleChannelOrExtendedChannelData(const QByteArray &dat
void AbstractSshChannel::closeChannel()
{
if (m_state == CloseRequested) {
- m_timeoutTimer->stop();
+ m_timeoutTimer.stop();
} else if (m_state != Closed) {
if (m_state == Inactive) {
setChannelState(Closed);
diff --git a/src/libs/ssh/sshchannel_p.h b/src/libs/ssh/sshchannel_p.h
index cd1685e133..ffa83c9fea 100644
--- a/src/libs/ssh/sshchannel_p.h
+++ b/src/libs/ssh/sshchannel_p.h
@@ -34,8 +34,7 @@
#include <QByteArray>
#include <QObject>
#include <QString>
-
-QT_FORWARD_DECLARE_CLASS(QTimer)
+#include <QTimer>
namespace QSsh {
namespace Internal {
@@ -95,7 +94,7 @@ protected:
void checkChannelActive();
SshSendFacility &m_sendFacility;
- QTimer * const m_timeoutTimer;
+ QTimer m_timeoutTimer;
private:
virtual void handleOpenSuccessInternal() = 0;
diff --git a/src/libs/ssh/sshdirecttcpiptunnel.cpp b/src/libs/ssh/sshdirecttcpiptunnel.cpp
index c792dfeab3..981876b5b9 100644
--- a/src/libs/ssh/sshdirecttcpiptunnel.cpp
+++ b/src/libs/ssh/sshdirecttcpiptunnel.cpp
@@ -160,7 +160,7 @@ void SshDirectTcpIpTunnel::initialize()
d->m_remotePort, d->m_connectionInfo.localAddress.toString().toUtf8(),
d->m_connectionInfo.localPort);
d->setChannelState(AbstractSshChannel::SessionRequested);
- d->m_timeoutTimer->start(d->ReplyTimeout);
+ d->m_timeoutTimer.start(d->ReplyTimeout);
} catch (Botan::Exception &e) { // Won't happen, but let's play it safe.
qDebug("Botan error: %s", e.what());
d->closeChannel();
diff --git a/src/libs/ssh/sshremoteprocess.cpp b/src/libs/ssh/sshremoteprocess.cpp
index bd8bd6dc9f..f6c9f2def2 100644
--- a/src/libs/ssh/sshremoteprocess.cpp
+++ b/src/libs/ssh/sshremoteprocess.cpp
@@ -304,7 +304,7 @@ void SshRemoteProcessPrivate::handleOpenSuccessInternal()
else
m_sendFacility.sendExecPacket(remoteChannel(), m_command);
setProcState(ExecRequested);
- m_timeoutTimer->start(ReplyTimeout);
+ m_timeoutTimer.start(ReplyTimeout);
}
void SshRemoteProcessPrivate::handleOpenFailureInternal(const QString &reason)
@@ -319,7 +319,7 @@ void SshRemoteProcessPrivate::handleChannelSuccess()
throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
"Unexpected SSH_MSG_CHANNEL_SUCCESS message.");
}
- m_timeoutTimer->stop();
+ m_timeoutTimer.stop();
setProcState(Running);
}
@@ -329,7 +329,7 @@ void SshRemoteProcessPrivate::handleChannelFailure()
throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
"Unexpected SSH_MSG_CHANNEL_FAILURE message.");
}
- m_timeoutTimer->stop();
+ m_timeoutTimer.stop();
setProcState(StartFailed);
closeChannel();
}