mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
call: avoid potential deadlock
Do not emit CallSignal::StateChange while locked. Because if the client uses any method that lock callMutex_ it will be a deadlock. Change-Id: I49aa7cb4ee60b23ef069751a7c1abbf4c9fcec95
This commit is contained in:
@ -240,7 +240,7 @@ Call::validStateTransition(CallState newState)
|
|||||||
bool
|
bool
|
||||||
Call::setState(CallState call_state, ConnectionState cnx_state, signed code)
|
Call::setState(CallState call_state, ConnectionState cnx_state, signed code)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock(callMutex_);
|
std::unique_lock<std::recursive_mutex> lock(callMutex_);
|
||||||
JAMI_DBG("[call:%s] state change %u/%u, cnx %u/%u, code %d",
|
JAMI_DBG("[call:%s] state change %u/%u, cnx %u/%u, code %d",
|
||||||
id_.c_str(),
|
id_.c_str(),
|
||||||
(unsigned) callState_,
|
(unsigned) callState_,
|
||||||
@ -275,6 +275,7 @@ Call::setState(CallState call_state, ConnectionState cnx_state, signed code)
|
|||||||
id_.c_str(),
|
id_.c_str(),
|
||||||
new_client_state.c_str(),
|
new_client_state.c_str(),
|
||||||
code);
|
code);
|
||||||
|
lock.unlock();
|
||||||
emitSignal<DRing::CallSignal::StateChange>(id_, new_client_state, code);
|
emitSignal<DRing::CallSignal::StateChange>(id_, new_client_state, code);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user