Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
f038fe78
Commit
f038fe78
authored
Jul 20, 2020
by
Adrien Béraud
Browse files
jamiaccount: lock doRegister
Change-Id: Ifa4bc41febb2149abd14fe8f4f30bb8e93bf9bb2
parent
4357af81
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/jamidht/jamiaccount.cpp
View file @
f038fe78
...
@@ -1651,8 +1651,10 @@ void
...
@@ -1651,8 +1651,10 @@ void
JamiAccount
::
registerAsyncOps
()
JamiAccount
::
registerAsyncOps
()
{
{
auto
onLoad
=
[
this
,
loaded
=
std
::
make_shared
<
std
::
atomic_uint
>
()]{
auto
onLoad
=
[
this
,
loaded
=
std
::
make_shared
<
std
::
atomic_uint
>
()]{
if
(
++
(
*
loaded
)
==
2u
)
if
(
++
(
*
loaded
)
==
2u
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
configurationMutex_
);
doRegister_
();
doRegister_
();
}
};
};
loadCachedProxyServer
([
onLoad
](
const
std
::
string
&
)
{
loadCachedProxyServer
([
onLoad
](
const
std
::
string
&
)
{
...
@@ -1684,6 +1686,7 @@ JamiAccount::registerAsyncOps()
...
@@ -1684,6 +1686,7 @@ JamiAccount::registerAsyncOps()
void
void
JamiAccount
::
doRegister
()
JamiAccount
::
doRegister
()
{
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
configurationMutex_
);
if
(
not
isUsable
())
{
if
(
not
isUsable
())
{
JAMI_WARN
(
"Account must be enabled and active to register, ignoring"
);
JAMI_WARN
(
"Account must be enabled and active to register, ignoring"
);
return
;
return
;
...
@@ -1848,8 +1851,6 @@ JamiAccount::onTrackedBuddyOffline(const dht::InfoHash& contactId)
...
@@ -1848,8 +1851,6 @@ JamiAccount::onTrackedBuddyOffline(const dht::InfoHash& contactId)
void
void
JamiAccount
::
doRegister_
()
JamiAccount
::
doRegister_
()
{
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
configurationMutex_
);
if
(
registrationState_
!=
RegistrationState
::
TRYING
)
{
if
(
registrationState_
!=
RegistrationState
::
TRYING
)
{
JAMI_ERR
(
"[Account %s] already registered"
,
getAccountID
().
c_str
());
JAMI_ERR
(
"[Account %s] already registered"
,
getAccountID
().
c_str
());
return
;
return
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment