summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/remoteserver.cpp
diff options
context:
space:
mode:
authorkh <karsten.heimrich@theqtcompany.com>2014-11-24 17:39:06 +0100
committerKarsten Heimrich <karsten.heimrich@theqtcompany.com>2014-11-26 14:49:23 +0100
commit64d49f097f25dd019345a7e913e1c4cf8188e168 (patch)
treeda6670298b59bd04db7d1f5dc62a9ceb79082b7b /src/libs/installer/remoteserver.cpp
parentd18b9696e573aa7b3f38784f6c5764b9fe6fd81b (diff)
Implement a way to start the server in debug mode and API cleanup.
1; Passing debug as first argument to the starting server does not start the server side so the server keeps running in an endless loop. This makes it far easier to attach a debugger. 2; API cleanup and unify init function to take port, key, and mode. The address was never able to be changed anyway, so stop passing them around. Change-Id: I2a847f009ed1557a5e136e2b0006de5c62426da2 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/libs/installer/remoteserver.cpp')
-rw-r--r--src/libs/installer/remoteserver.cpp44
1 files changed, 28 insertions, 16 deletions
diff --git a/src/libs/installer/remoteserver.cpp b/src/libs/installer/remoteserver.cpp
index f47cb30ab..c3ec93c85 100644
--- a/src/libs/installer/remoteserver.cpp
+++ b/src/libs/installer/remoteserver.cpp
@@ -39,6 +39,9 @@
namespace QInstaller {
+/*!
+ Constructs an remote server object with \a parent.
+*/
RemoteServer::RemoteServer(QObject *parent)
: QObject(parent)
, d_ptr(new RemoteServerPrivate(this))
@@ -46,6 +49,9 @@ RemoteServer::RemoteServer(QObject *parent)
Repository::registerMetaType(); // register, cause we stream the type as QVariant
}
+/*!
+ Destroys the remote server object.
+*/
RemoteServer::~RemoteServer()
{
Q_D(RemoteServer);
@@ -54,8 +60,10 @@ RemoteServer::~RemoteServer()
}
/*!
- Starts the server. If started in debug mode, the watchdog that kills the server after
- 30 seconds without usage is not started. The authorization key is set to "DebugMode".
+ Starts the server.
+
+ \note If running in debug mode, the timer that kills the server after 30 seconds without
+ usage is not started, so the server runs in an endless loop.
*/
void RemoteServer::start()
{
@@ -69,36 +77,40 @@ void RemoteServer::start()
connect (d->m_tcpServer, SIGNAL(newIncomingConnection()), this, SLOT(restartWatchdog()));
d->m_thread.start();
- if (d->m_mode == Protocol::Mode::Release) {
+ if (d->m_mode == Protocol::Mode::Production) {
connect(d->m_watchdog.data(), SIGNAL(timeout()), this, SLOT(deleteLater()));
d->m_watchdog->start();
}
}
/*!
- Returns the authorization key.
+ Initializes the server with \a port, the port to listen on, with \a key, the key the client
+ needs to send to authenticate with the server, and \a mode.
*/
-QString RemoteServer::authorizationKey() const
+void RemoteServer::init(quint16 port, const QString &key, Protocol::Mode mode)
{
- Q_D(const RemoteServer);
- return d->m_key;
+ Q_D(RemoteServer);
+ d->m_port = port;
+ d->m_key = key;
+ d->m_mode = mode;
}
/*!
- Sets the authorization key \a authorizationKey this server is asking the clients for.
+ Returns the port the server is listening on.
*/
-void RemoteServer::setAuthorizationKey(const QString &authorizationKey)
+quint16 RemoteServer::port() const
{
- Q_D(RemoteServer);
- d->m_key = authorizationKey;
+ Q_D(const RemoteServer);
+ return d->m_port;
}
-void RemoteServer::init(quint16 port, const QHostAddress &address, Protocol::Mode mode)
+/*!
+ Returns the authorization key.
+*/
+QString RemoteServer::authorizationKey() const
{
- Q_D(RemoteServer);
- d->m_port = port;
- d->m_address = address;
- d->m_mode = mode;
+ Q_D(const RemoteServer);
+ return d->m_key;
}
/*!