Skip to content
Snippets Groups Projects
Commit 91365f81 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

account_manager: fix forEachDevices

We need to wait that all devices are found before stopping
forEachDevices. This fix ut_call.

Change-Id: Ic695869957fbd1a6f28e11fa6ffb59d6447841e7
GitLab: https://git.jami.net/savoirfairelinux/ring-project/-/issues/1282
parent b692a6d7
No related branches found
No related tags found
No related merge requests found
...@@ -724,7 +724,7 @@ AccountManager::forEachDevice( ...@@ -724,7 +724,7 @@ AccountManager::forEachDevice(
struct State struct State
{ {
unsigned remaining {0}; unsigned remaining {1}; // Note: state is initialized to 1, because we need to wait that the get is finished
std::set<dht::PkId> treatedDevices {}; std::set<dht::PkId> treatedDevices {};
std::function<void(const std::shared_ptr<dht::crypto::PublicKey>&)> onDevice; std::function<void(const std::shared_ptr<dht::crypto::PublicKey>&)> onDevice;
std::function<void(bool)> onEnd; std::function<void(bool)> onEnd;
...@@ -767,7 +767,9 @@ AccountManager::forEachDevice( ...@@ -767,7 +767,9 @@ AccountManager::forEachDevice(
}); });
return true; return true;
}, },
[state](bool /*ok*/) { state->ended(); }); [state](bool /*ok*/) {
state->found({});
});
} }
void void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment