summaryrefslogtreecommitdiffstats
path: root/common/resourceaccess.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/resourceaccess.cpp')
-rw-r--r--common/resourceaccess.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp
index 28aaf2e..f448897 100644
--- a/common/resourceaccess.cpp
+++ b/common/resourceaccess.cpp
@@ -140,7 +140,9 @@ Async::Job<void> ResourceAccess::Private::initializeSocket()
140 //We failed to connect, so let's start the resource 140 //We failed to connect, so let's start the resource
141 QStringList args; 141 QStringList args;
142 args << resourceName; 142 args << resourceName;
143 if (QProcess::startDetached("akonadi2_synchronizer", args, QDir::homePath())) { 143 qint64 pid = 0;
144 if (QProcess::startDetached("akonadi2_synchronizer", args, QDir::homePath(), &pid)) {
145 Trace() << "Started resource " << pid;
144 tryToConnect() 146 tryToConnect()
145 .then<void>([&future]() { 147 .then<void>([&future]() {
146 future.setFinished(); 148 future.setFinished();
@@ -257,9 +259,9 @@ void ResourceAccess::sendCommand(const QSharedPointer<QueuedCommand> &command)
257 const auto messageId = d->messageId; 259 const auto messageId = d->messageId;
258 log(QString("Sending command \"%1\" with messageId %2").arg(QString(Akonadi2::Commands::name(command->commandId))).arg(d->messageId)); 260 log(QString("Sending command \"%1\" with messageId %2").arg(QString(Akonadi2::Commands::name(command->commandId))).arg(d->messageId));
259 if (command->callback) { 261 if (command->callback) {
260 registerCallback(d->messageId, [this, messageId, command](int number, QString foo) { 262 registerCallback(d->messageId, [this, messageId, command](int errorCode, QString errorMessage) {
261 d->pendingCommands.remove(messageId); 263 d->pendingCommands.remove(messageId);
262 command->callback(number, foo); 264 command->callback(errorCode, errorMessage);
263 }); 265 });
264 } 266 }
265 //Keep track of the command until we're sure it arrived 267 //Keep track of the command until we're sure it arrived
@@ -336,7 +338,7 @@ bool ResourceAccess::processMessageBuffer()
336{ 338{
337 static const int headerSize = Commands::headerSize(); 339 static const int headerSize = Commands::headerSize();
338 if (d->partialMessageBuffer.size() < headerSize) { 340 if (d->partialMessageBuffer.size() < headerSize) {
339 qWarning() << "command too small"; 341 Warning() << "command too small";
340 return false; 342 return false;
341 } 343 }
342 344
@@ -345,7 +347,7 @@ bool ResourceAccess::processMessageBuffer()
345 const uint size = *(int*)(d->partialMessageBuffer.constData() + sizeof(int) + sizeof(uint)); 347 const uint size = *(int*)(d->partialMessageBuffer.constData() + sizeof(int) + sizeof(uint));
346 348
347 if (size > (uint)(d->partialMessageBuffer.size() - headerSize)) { 349 if (size > (uint)(d->partialMessageBuffer.size() - headerSize)) {
348 qWarning() << "command too small"; 350 Warning() << "command too small";
349 return false; 351 return false;
350 } 352 }
351 353