Commit f038fe78 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

jamiaccount: lock doRegister

Change-Id: Ifa4bc41febb2149abd14fe8f4f30bb8e93bf9bb2
parent 4357af81
......@@ -1651,8 +1651,10 @@ void
JamiAccount::registerAsyncOps()
{
auto onLoad = [this, loaded = std::make_shared<std::atomic_uint>()]{
if (++(*loaded) == 2u)
if (++(*loaded) == 2u) {
std::lock_guard<std::mutex> lock(configurationMutex_);
doRegister_();
}
};
loadCachedProxyServer([onLoad](const std::string&) {
......@@ -1684,6 +1686,7 @@ JamiAccount::registerAsyncOps()
void
JamiAccount::doRegister()
{
std::lock_guard<std::mutex> lock(configurationMutex_);
if (not isUsable()) {
JAMI_WARN("Account must be enabled and active to register, ignoring");
return;
......@@ -1848,8 +1851,6 @@ JamiAccount::onTrackedBuddyOffline(const dht::InfoHash& contactId)
void
JamiAccount::doRegister_()
{
std::lock_guard<std::mutex> lock(configurationMutex_);
if (registrationState_ != RegistrationState::TRYING) {
JAMI_ERR("[Account %s] already registered", getAccountID().c_str());
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment