summaryrefslogtreecommitdiffstats
path: root/src/sdk
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@theqtcompany.com>2015-02-10 16:21:26 +0100
committerKai Koehne <kai.koehne@theqtcompany.com>2015-02-20 10:22:28 +0000
commitd6bca86cad962a0078c2a8111133cff123f1ba0a (patch)
tree0f8cf9863c04675c24efe2bf6b0aa023a56a0f4c /src/sdk
parent0ff36e52afb503a99c8fded093d25321a46b3d19 (diff)
Use local sockets for client-server communication
Change-Id: I12bfef671ab31ae9fb8c4bb02776517e7f434d27 Task-number: QTIFW-228 Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Diffstat (limited to 'src/sdk')
-rw-r--r--src/sdk/commandlineparser.cpp4
-rw-r--r--src/sdk/installerbase.cpp7
-rw-r--r--src/sdk/main.cpp10
3 files changed, 11 insertions, 10 deletions
diff --git a/src/sdk/commandlineparser.cpp b/src/sdk/commandlineparser.cpp
index d1af0d97e..23e9a5dfc 100644
--- a/src/sdk/commandlineparser.cpp
+++ b/src/sdk/commandlineparser.cpp
@@ -97,12 +97,12 @@ CommandLineParser::CommandLineParser()
QLatin1String("Starts the application as headless process waiting for commands to execute."
" Mode can be DEBUG or PRODUCTION. In DEBUG mode, the option values can be omitted."
"Note: The server will not shutdown on his own, you need to quit the process by hand."),
- QLatin1String("mode,port,key")));
+ QLatin1String("mode,socketname,key")));
m_parser.addOption(QCommandLineOption(QLatin1String(CommandLineOptions::StartClient),
QString::fromLatin1("Starts the application to debug the client-server communication. If "
"a value is omitted, the client will use a default instead. Note: The server process is "
"not started by the client application in that case, you need to start it on your own."),
- QLatin1String("port,key")));
+ QLatin1String("socketname,key")));
m_parser.addPositionalArgument(QLatin1String(CommandLineOptions::KeyValue),
QLatin1String("Key Value pair to be set."));
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp
index 269cc2cea..d2fb82562 100644
--- a/src/sdk/installerbase.cpp
+++ b/src/sdk/installerbase.cpp
@@ -118,13 +118,14 @@ int InstallerBase::run()
if (parser.isSet(QLatin1String(CommandLineOptions::StartClient))) {
const QStringList arguments = parser.value(QLatin1String(CommandLineOptions::StartClient))
.split(QLatin1Char(','), QString::SkipEmptyParts);
- m_core = new QInstaller::PackageManagerCore(magicMarker, oldOperations, QString(arguments
- .value(0, QString::number(QInstaller::Protocol::DefaultPort))).toInt(),
+ m_core = new QInstaller::PackageManagerCore(
+ magicMarker, oldOperations,
+ arguments.value(0, QLatin1String(QInstaller::Protocol::DefaultSocket)),
arguments.value(1, QLatin1String(QInstaller::Protocol::DefaultAuthorizationKey)),
QInstaller::Protocol::Mode::Debug);
} else {
m_core = new QInstaller::PackageManagerCore(magicMarker, oldOperations,
- 30000 + qrand() % 100, QUuid::createUuid().toString());
+ QUuid::createUuid().toString(), QUuid::createUuid().toString());
}
{
diff --git a/src/sdk/main.cpp b/src/sdk/main.cpp
index 6932f0d37..a35f1a95a 100644
--- a/src/sdk/main.cpp
+++ b/src/sdk/main.cpp
@@ -119,22 +119,22 @@ int main(int argc, char *argv[])
const QStringList arguments = parser.value(QLatin1String(CommandLineOptions::StartServer))
.split(QLatin1Char(','), QString::SkipEmptyParts);
- QString port, key;
+ QString socketName, key;
const QString mode = arguments.value(0);
bool argumentsValid = (mode.compare(QLatin1String(QInstaller::Protocol::ModeDebug),
Qt::CaseInsensitive) == 0);
if (argumentsValid) {
- port = arguments.value(1, QString::number(QInstaller::Protocol::DefaultPort));
+ socketName = arguments.value(1, QLatin1String(QInstaller::Protocol::DefaultSocket));
key = arguments.value(2, QLatin1String(QInstaller::Protocol::DefaultAuthorizationKey));
} else {
- port = arguments.value(1);
+ socketName = arguments.value(1);
key = arguments.value(2);
}
const bool production = (mode.compare(QLatin1String(QInstaller::Protocol::ModeProduction),
Qt::CaseInsensitive) == 0);
if (production)
- argumentsValid = (!key.isEmpty()) && (!port.isEmpty());
+ argumentsValid = (!key.isEmpty()) && (!socketName.isEmpty());
SDKApp<QCoreApplication> app(argc, argv);
if (!argumentsValid) {
@@ -146,7 +146,7 @@ int main(int argc, char *argv[])
QInstaller::RemoteServer *server = new QInstaller::RemoteServer;
QObject::connect(server, SIGNAL(destroyed()), &app, SLOT(quit()));
- server->init(port.toInt(), key, (production ? QInstaller::Protocol::Mode::Production
+ server->init(socketName, key, (production ? QInstaller::Protocol::Mode::Production
: QInstaller::Protocol::Mode::Debug));
server->start();