Skip to content
Snippets Groups Projects
Commit 135cfe7d authored by Adrien Béraud's avatar Adrien Béraud Committed by Guillaume Roguez
Browse files

call: emit signal on removal

The "OVER" event is the point in time from which the daemon won't know
about this call ID anymore.
There is always exactly one OVER event when a call is removed.

Tuleap: #102
Change-Id: Id11b9047b27c33258b731f7843fd7241e4c7c07f
parent 70c84b35
No related branches found
No related tags found
No related merge requests found
...@@ -56,8 +56,10 @@ Call::~Call() ...@@ -56,8 +56,10 @@ Call::~Call()
void void
Call::removeCall() Call::removeCall()
{ {
auto this_ = shared_from_this();
Manager::instance().callFactory.removeCall(*this); Manager::instance().callFactory.removeCall(*this);
iceTransport_.reset(); iceTransport_.reset();
setState(CallState::OVER);
} }
const std::string& const std::string&
...@@ -86,6 +88,11 @@ Call::validStateTransition(CallState newState) ...@@ -86,6 +88,11 @@ Call::validStateTransition(CallState newState)
// Notice to developper: // Notice to developper:
// - list only permitted transition (return true) // - list only permitted transition (return true)
// - let non permitted ones as default case (return false) // - let non permitted ones as default case (return false)
// always permited
if (newState == CallState::OVER)
return true;
switch (callState_) { switch (callState_) {
case CallState::INACTIVE: case CallState::INACTIVE:
switch (newState) { switch (newState) {
...@@ -219,6 +226,9 @@ Call::getStateStr() const ...@@ -219,6 +226,9 @@ Call::getStateStr() const
return StateEvent::INACTIVE; return StateEvent::INACTIVE;
} }
case CallState::OVER:
return StateEvent::OVER;
case CallState::MERROR: case CallState::MERROR:
default: default:
return StateEvent::FAILURE; return StateEvent::FAILURE;
......
...@@ -84,7 +84,7 @@ class Call : public Recordable, public std::enable_shared_from_this<Call> { ...@@ -84,7 +84,7 @@ class Call : public Recordable, public std::enable_shared_from_this<Call> {
* \note modify validStateTransition/getStateStr if this enum changes * \note modify validStateTransition/getStateStr if this enum changes
*/ */
enum class CallState : unsigned { enum class CallState : unsigned {
INACTIVE, ACTIVE, HOLD, BUSY, MERROR, COUNT__ INACTIVE, ACTIVE, HOLD, BUSY, MERROR, OVER, COUNT__
}; };
virtual ~Call(); virtual ~Call();
......
...@@ -36,6 +36,7 @@ constexpr static char FAILURE [] = "FAILURE" ; ...@@ -36,6 +36,7 @@ constexpr static char FAILURE [] = "FAILURE" ;
constexpr static char HOLD [] = "HOLD" ; constexpr static char HOLD [] = "HOLD" ;
constexpr static char UNHOLD [] = "UNHOLD" ; constexpr static char UNHOLD [] = "UNHOLD" ;
constexpr static char INACTIVE [] = "INACTIVE" ; constexpr static char INACTIVE [] = "INACTIVE" ;
constexpr static char OVER [] = "OVER" ;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment