private function processCancel(Session $session, CancelMessage $msg)
{
$call = $this->getCallByRequestId($msg->getRequestId());
if ($call && $call->getCallerSession() !== $session) {
Logger::warning($this, "Attempt to cancel call by non-owner");
return;
}
if (!$call) {
$errorMsg = ErrorMessage::createErrorMessageFromMessage($msg);
$errorMsg->setErrorURI("wamp.error.no_such_call");
$session->sendMessage($errorMsg);
Logger::error($this, "wamp.error.no_such_call");
return;
}
if ($call->getInterruptMessage()) {
$errorMsg = ErrorMessage::createErrorMessageFromMessage($msg);
$errorMsg->setErrorURI("wamp.error.canceling");
Logger::warning($this, "There was an attempt to cancel a message that is already in the process of being canceled");
return;
}
$removeCall = $call->processCancel($session, $msg);
if ($call->getInterruptMessage()) {
$this->callInterruptIndex[$call->getInterruptMessage()->getRequestId()] = $call;
}
if ($removeCall) {
$this->removeCall($call);
}
}