Skip to content

Commit

Permalink
Send a CancelMessage to all active calls, when the caller's session t…
Browse files Browse the repository at this point in the history
…erminates
  • Loading branch information
davidwdan authored and mbonneau committed Sep 8, 2016
1 parent 1fddead commit dc478ec
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Thruway/Role/Dealer.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ private function processCancel(Session $session, CancelMessage $msg)
{
$call = $this->getCallByRequestId($msg->getRequestId());

if ($call->getCallerSession() !== $session) {
if ($call && $call->getCallerSession() !== $session) {
Logger::warning($this, "Attempt to cancel call by non-owner");

return;
Expand Down Expand Up @@ -554,6 +554,13 @@ public function leave(Session $session)
$procedure->leave($session);
}

foreach ($this->callInvocationIndex as $call) {
if ($session->getSessionId() === $call->getCallerSession()->getSessionId()) {
$cancelMsg = new CancelMessage($call->getCallMessage()->getRequestId(), (object)[]);
$this->processCancel($session, $cancelMsg);
}
}

// remove the list of registrations
if ($this->registrationsBySession->contains($session)) {
$this->registrationsBySession->detach($session);
Expand Down

0 comments on commit dc478ec

Please sign in to comment.