summaryrefslogtreecommitdiffstats
path: root/common/resourceaccess.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-03-27 16:45:48 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-03-31 11:11:08 +0200
commit7642433a4fafd2ccf7e8b43c81ec18282f544a3b (patch)
tree067d1faa86061eabe24444e59118e9c1567848ba /common/resourceaccess.cpp
parentc9aeb8896ae578515c217b9a08988156b4d62f1e (diff)
downloadsink-7642433a4fafd2ccf7e8b43c81ec18282f544a3b.tar.gz
sink-7642433a4fafd2ccf7e8b43c81ec18282f544a3b.zip
Shutdown notification to achieve a clean shutdown.
Otherwise the client always restarts the resource because of the lost connection. We currently require this in tests to be able to delete the db, but eventually we likely want a "disable akonadi" function that shuts resources down, and keeps clients from restarting them (e.g. via configuration).
Diffstat (limited to 'common/resourceaccess.cpp')
-rw-r--r--common/resourceaccess.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp
index 59cbece..20e1e8c 100644
--- a/common/resourceaccess.cpp
+++ b/common/resourceaccess.cpp
@@ -25,6 +25,7 @@
25#include "common/handshake_generated.h" 25#include "common/handshake_generated.h"
26#include "common/revisionupdate_generated.h" 26#include "common/revisionupdate_generated.h"
27#include "common/synchronize_generated.h" 27#include "common/synchronize_generated.h"
28#include "common/notification_generated.h"
28#include "log.h" 29#include "log.h"
29 30
30#include <QCoreApplication> 31#include <QCoreApplication>
@@ -325,6 +326,19 @@ bool ResourceAccess::processMessageBuffer()
325 QMetaObject::invokeMethod(this, "callCallbacks", Qt::QueuedConnection, QGenericReturnArgument(), Q_ARG(int, buffer->id())); 326 QMetaObject::invokeMethod(this, "callCallbacks", Qt::QueuedConnection, QGenericReturnArgument(), Q_ARG(int, buffer->id()));
326 break; 327 break;
327 } 328 }
329 case Commands::NotificationCommand: {
330 auto buffer = GetNotification(d->partialMessageBuffer.constData() + headerSize);
331 switch (buffer->type()) {
332 case Akonadi2::NotificationType::NotificationType_Shutdown:
333 Log() << "Received shutdown notification.";
334 close();
335 break;
336 default:
337 Warning() << "Received unknown notification: " << buffer->type();
338 break;
339 }
340 break;
341 }
328 default: 342 default:
329 break; 343 break;
330 } 344 }