diff options
Diffstat (limited to 'common/listener.cpp')
-rw-r--r-- | common/listener.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/common/listener.cpp b/common/listener.cpp index 4316c63..2e2e98e 100644 --- a/common/listener.cpp +++ b/common/listener.cpp | |||
@@ -45,8 +45,6 @@ Listener::Listener(const QByteArray &resourceInstanceIdentifier, QObject *parent | |||
45 | m_clientBufferProcessesTimer(new QTimer(this)), | 45 | m_clientBufferProcessesTimer(new QTimer(this)), |
46 | m_messageId(0) | 46 | m_messageId(0) |
47 | { | 47 | { |
48 | connect(m_pipeline, &Akonadi2::Pipeline::revisionUpdated, | ||
49 | this, &Listener::refreshRevision); | ||
50 | connect(m_server, &QLocalServer::newConnection, | 48 | connect(m_server, &QLocalServer::newConnection, |
51 | this, &Listener::acceptConnection); | 49 | this, &Listener::acceptConnection); |
52 | Trace() << "Trying to open " << m_resourceInstanceIdentifier; | 50 | Trace() << "Trying to open " << m_resourceInstanceIdentifier; |
@@ -325,18 +323,6 @@ bool Listener::processClientBuffer(Client &client) | |||
325 | return false; | 323 | return false; |
326 | } | 324 | } |
327 | 325 | ||
328 | void Listener::sendCurrentRevision(Client &client) | ||
329 | { | ||
330 | if (!client.socket || !client.socket->isValid()) { | ||
331 | return; | ||
332 | } | ||
333 | |||
334 | auto command = Akonadi2::CreateRevisionUpdate(m_fbb, m_pipeline->storage().maxRevision()); | ||
335 | Akonadi2::FinishRevisionUpdateBuffer(m_fbb, command); | ||
336 | Akonadi2::Commands::write(client.socket, ++m_messageId, Akonadi2::Commands::RevisionUpdateCommand, m_fbb); | ||
337 | m_fbb.Clear(); | ||
338 | } | ||
339 | |||
340 | void Listener::sendCommandCompleted(QLocalSocket *socket, uint messageId) | 326 | void Listener::sendCommandCompleted(QLocalSocket *socket, uint messageId) |
341 | { | 327 | { |
342 | if (!socket || !socket->isValid()) { | 328 | if (!socket || !socket->isValid()) { |
@@ -349,15 +335,15 @@ void Listener::sendCommandCompleted(QLocalSocket *socket, uint messageId) | |||
349 | m_fbb.Clear(); | 335 | m_fbb.Clear(); |
350 | } | 336 | } |
351 | 337 | ||
352 | void Listener::refreshRevision() | 338 | void Listener::refreshRevision(qint64 revision) |
353 | { | 339 | { |
354 | updateClientsWithRevision(); | 340 | updateClientsWithRevision(revision); |
355 | } | 341 | } |
356 | 342 | ||
357 | void Listener::updateClientsWithRevision() | 343 | void Listener::updateClientsWithRevision(qint64 revision) |
358 | { | 344 | { |
359 | //FIXME don't send revision updates for revisions that are still being processed. | 345 | //FIXME don't send revision updates for revisions that are still being processed. |
360 | auto command = Akonadi2::CreateRevisionUpdate(m_fbb, m_pipeline->storage().maxRevision()); | 346 | auto command = Akonadi2::CreateRevisionUpdate(m_fbb, revision); |
361 | Akonadi2::FinishRevisionUpdateBuffer(m_fbb, command); | 347 | Akonadi2::FinishRevisionUpdateBuffer(m_fbb, command); |
362 | 348 | ||
363 | for (const Client &client: m_connections) { | 349 | for (const Client &client: m_connections) { |
@@ -382,6 +368,8 @@ void Listener::loadResource() | |||
382 | Log() << QString("Resource factory: %1").arg((qlonglong)resourceFactory); | 368 | Log() << QString("Resource factory: %1").arg((qlonglong)resourceFactory); |
383 | Log() << QString("\tResource: %1").arg((qlonglong)m_resource); | 369 | Log() << QString("\tResource: %1").arg((qlonglong)m_resource); |
384 | m_resource->configurePipeline(m_pipeline); | 370 | m_resource->configurePipeline(m_pipeline); |
371 | connect(m_resource, &Akonadi2::Resource::revisionUpdated, | ||
372 | this, &Listener::refreshRevision); | ||
385 | } else { | 373 | } else { |
386 | ErrorMsg() << "Failed to load resource " << m_resourceName; | 374 | ErrorMsg() << "Failed to load resource " << m_resourceName; |
387 | } | 375 | } |