mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
conversation_module: try to clone requests on bootstrap
Since the DRT, we're not using trackPresence to start syncing with other members of the conversation but "bootstrap". For bootstraping conversation's requests we should try to clone it with the members marked in the convInfo. Change-Id: I4095ee59d56a28c4a24f8f4ddd9116109e6d0b7c
This commit is contained in:
@ -1262,15 +1262,33 @@ ConversationModule::bootstrap(const std::string& convId)
|
||||
std::bind(&ConversationModule::Impl::bootstrapCb, pimpl_.get(), conv->id()), kd);
|
||||
}
|
||||
};
|
||||
std::vector<std::string> toClone;
|
||||
std::unique_lock<std::mutex> lk(pimpl_->conversationsMtx_);
|
||||
std::unique_lock<std::mutex> lkCi(pimpl_->convInfosMtx_);
|
||||
if (convId.empty()) {
|
||||
for (auto& [_, conv] : pimpl_->conversations_) {
|
||||
bootstrap(conv);
|
||||
for (const auto& [key, ci] : pimpl_->convInfos_) {
|
||||
auto it = pimpl_->conversations_.find(key);
|
||||
if (it != pimpl_->conversations_.end() && it->second) {
|
||||
bootstrap(it->second);
|
||||
} else {
|
||||
// Because we're not tracking contact presence in order to sync now,
|
||||
// we need to ask to clone requests when bootstraping all conversations
|
||||
// else it can stay syncing
|
||||
toClone.emplace_back(key);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
auto it = pimpl_->conversations_.find(convId);
|
||||
if (it != pimpl_->conversations_.end()) {
|
||||
if (it != pimpl_->conversations_.end())
|
||||
bootstrap(it->second);
|
||||
}
|
||||
lkCi.unlock();
|
||||
lk.unlock();
|
||||
for (const auto& cid: toClone) {
|
||||
auto members = getConversationMembers(cid);
|
||||
for (const auto& member : members) {
|
||||
if (member.at("uri") != pimpl_->username_)
|
||||
cloneConversationFrom(cid, member.at("uri"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -689,8 +689,7 @@ SyncHistoryTest::testSyncCreateAccountExportDeleteReimportWithConvId()
|
||||
conversationReady = false;
|
||||
alice2Id = Manager::instance().addAccount(details);
|
||||
// Should retrieve conversation, no need for action as the convInfos is in the archive
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&] { return alice2Ready; }));
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&] { return conversationReady; }));
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&] { return alice2Ready && conversationReady; }));
|
||||
|
||||
messageBobReceived = 0;
|
||||
libjami::sendMessage(alice2Id, convId, std::string("hi"), "");
|
||||
|
Reference in New Issue
Block a user