conversation: fix ConversationSyncFinished

This patch increase fetched conversation number earlier,
so ConversationSyncFinished would not be emitted in case when
second call to fetchNewCommits happened before receiving callback
from onNeedSocket_.

Change-Id: I72263768426fcce671029fd165323ce89e49e91b
This commit is contained in:
Kateryna Kostiuk
2022-08-25 10:24:44 -04:00
parent 53f60a1aa4
commit 5962210088

View File

@ -403,6 +403,7 @@ ConversationModule::Impl::fetchNewCommits(const std::string& peer,
conversationId.c_str()); conversationId.c_str());
return; return;
} }
syncCnt.fetch_add(1);
onNeedSocket_(conversationId, onNeedSocket_(conversationId,
deviceId, deviceId,
[this, [this,
@ -416,10 +417,10 @@ ConversationModule::Impl::fetchNewCommits(const std::string& peer,
|| !conversation->second) { || !conversation->second) {
std::lock_guard<std::mutex> lk(pendingConversationsFetchMtx_); std::lock_guard<std::mutex> lk(pendingConversationsFetchMtx_);
stopFetch(conversationId, deviceId); stopFetch(conversationId, deviceId);
syncCnt.fetch_sub(1);
return false; return false;
} }
acc->addGitSocket(channel->deviceId(), conversationId, channel); acc->addGitSocket(channel->deviceId(), conversationId, channel);
syncCnt.fetch_add(1);
conversation->second->sync( conversation->second->sync(
peer, peer,
deviceId, deviceId,