summaryrefslogtreecommitdiffstats
path: root/src/libs/installer/remoteclient_p.h
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/remoteclient_p.h
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/remoteclient_p.h')
-rw-r--r--src/libs/installer/remoteclient_p.h34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/libs/installer/remoteclient_p.h b/src/libs/installer/remoteclient_p.h
index 6405b5fe8..fdcfabb64 100644
--- a/src/libs/installer/remoteclient_p.h
+++ b/src/libs/installer/remoteclient_p.h
@@ -48,7 +48,6 @@
#include <QTcpSocket>
#include <QThread>
#include <QTimer>
-#include <QUuid>
namespace QInstaller {
@@ -142,17 +141,21 @@ public:
m_thread.wait();
}
- void init(quint16 port, const QHostAddress &address, Protocol::Mode mode)
+ void init(quint16 port, const QString &key, Protocol::Mode mode, Protocol::StartAs startAs)
{
- m_port = port;
m_mode = mode;
- m_address = address;
+ if (mode == Protocol::Mode::Production) {
+ m_key = key;
+ m_port = port;
+ m_mode = mode;
+ m_startServerAs = startAs;
+ m_serverCommand = QCoreApplication::applicationFilePath();
+ m_serverArguments = QStringList() << QLatin1String("--startserver")
+ << QString::fromLatin1("%1,%2,%3")
+ .arg(QLatin1String(Protocol::ModeProduction))
+ .arg(port)
+ .arg(key);
- if (mode == Protocol::Mode::Debug) {
- m_active = true;
- m_serverStarted = true;
- } else if (m_mode == Protocol::Mode::Release) {
- m_key = QUuid::createUuid().toString();
if (!m_object) {
m_object = new KeepAliveObject;
m_object->moveToThread(&m_thread);
@@ -162,13 +165,17 @@ public:
} else {
Q_ASSERT_X(false, Q_FUNC_INFO, "Keep alive thread already started.");
}
- } else {
- Q_ASSERT_X(false, Q_FUNC_INFO, "RemoteClient mode not set properly.");
+ } else if (mode == Protocol::Mode::Debug) {
+ // To be able to debug the client-server connection start and stop the server manually,
+ // e.g. installer --startserver debug. The server is listening on localhost:39999 then.
}
}
void maybeStartServer() {
- if (m_serverStarted || m_serverCommand.isEmpty())
+ if (m_mode == Protocol::Mode::Debug)
+ m_serverStarted = true; // we expect the server to be started by the developer
+
+ if (m_serverStarted)
return;
const QMutexLocker ml(&m_mutex);
@@ -218,6 +225,9 @@ public:
void maybeStopServer()
{
+ if (m_mode == Protocol::Mode::Debug)
+ m_serverStarted = false; // we never started the server in debug mode
+
if (!m_serverStarted)
return;