Skip to content
Snippets Groups Projects
Commit b7f6bfd2 authored by Sébastien Blin's avatar Sébastien Blin Committed by Adrien Béraud
Browse files

account: make callIDSet_ thread safe

Change-Id: Ib3d36408841d1b339a00bf9135b308afaa93b218
parent 387f6988
No related branches found
No related tags found
No related merge requests found
...@@ -122,18 +122,21 @@ Account::~Account() ...@@ -122,18 +122,21 @@ Account::~Account()
void void
Account::attachCall(const std::string& id) Account::attachCall(const std::string& id)
{ {
std::lock_guard<std::mutex> lk {callIDSetMtx_};
callIDSet_.insert(id); callIDSet_.insert(id);
} }
void void
Account::detachCall(const std::string& id) Account::detachCall(const std::string& id)
{ {
std::lock_guard<std::mutex> lk {callIDSetMtx_};
callIDSet_.erase(id); callIDSet_.erase(id);
} }
void void
Account::freeAccount() Account::freeAccount()
{ {
std::lock_guard<std::mutex> lk {callIDSetMtx_};
for (const auto& id : callIDSet_) for (const auto& id : callIDSet_)
Manager::instance().hangupCall(id); Manager::instance().hangupCall(id);
} }
......
...@@ -346,6 +346,7 @@ class Account : public Serializable, public std::enable_shared_from_this<Account ...@@ -346,6 +346,7 @@ class Account : public Serializable, public std::enable_shared_from_this<Account
/** /**
* Set of call's ID attached to the account. * Set of call's ID attached to the account.
*/ */
std::mutex callIDSetMtx_;
std::set<std::string> callIDSet_; std::set<std::string> callIDSet_;
void enableUpnp(bool state); void enableUpnp(bool state);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment