diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-04-29 01:11:40 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-04-29 01:11:40 +0200 |
commit | b0e7af2972b82364f8ca95fef8031cbd018d54e0 (patch) | |
tree | 3f6f1aad825e1b02aa5d9a882730c1be85ba5023 /common/clientapi.cpp | |
parent | 3c0e79b1e9088e3b55f65fe5cc440ffb08dfde0a (diff) | |
download | sink-b0e7af2972b82364f8ca95fef8031cbd018d54e0.tar.gz sink-b0e7af2972b82364f8ca95fef8031cbd018d54e0.zip |
Avoid starting the resource for shutdown.
Diffstat (limited to 'common/clientapi.cpp')
-rw-r--r-- | common/clientapi.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/common/clientapi.cpp b/common/clientapi.cpp index c6f5582..5cb3b69 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp | |||
@@ -2,6 +2,7 @@ | |||
2 | #include "clientapi.h" | 2 | #include "clientapi.h" |
3 | #include "resourceaccess.h" | 3 | #include "resourceaccess.h" |
4 | #include "commands.h" | 4 | #include "commands.h" |
5 | #include "log.h" | ||
5 | 6 | ||
6 | namespace async | 7 | namespace async |
7 | { | 8 | { |
@@ -39,10 +40,19 @@ QByteArray getTypeName<AkonadiResource>() | |||
39 | 40 | ||
40 | void Store::shutdown(const QByteArray &identifier) | 41 | void Store::shutdown(const QByteArray &identifier) |
41 | { | 42 | { |
42 | Akonadi2::ResourceAccess resourceAccess(identifier); | 43 | Trace() << "shutdown"; |
43 | //FIXME this starts the resource, just to shut it down again if it's not running in the first place. | 44 | ResourceAccess::connectToServer(identifier).then<void, QSharedPointer<QLocalSocket>>([identifier](const QSharedPointer<QLocalSocket> &socket, Async::Future<void> &future) { |
44 | resourceAccess.open(); | 45 | //We can't currently reuse the socket |
45 | resourceAccess.sendCommand(Akonadi2::Commands::ShutdownCommand).exec().waitForFinished(); | 46 | socket->close(); |
47 | auto resourceAccess = QSharedPointer<Akonadi2::ResourceAccess>::create(identifier); | ||
48 | resourceAccess->open(); | ||
49 | resourceAccess->sendCommand(Akonadi2::Commands::ShutdownCommand).then<void>([&future, resourceAccess]() { | ||
50 | future.setFinished(); | ||
51 | }).exec(); | ||
52 | }, | ||
53 | [](int, const QString &) { | ||
54 | //Resource isn't started, nothing to shutdown | ||
55 | }).exec().waitForFinished(); | ||
46 | } | 56 | } |
47 | 57 | ||
48 | } // namespace Akonadi2 | 58 | } // namespace Akonadi2 |