Esempio n. 1
0
 /**
  * process error
  *
  * @param \Thruway\Message\ErrorMessage $msg
  */
 protected function processError(ErrorMessage $msg)
 {
     if (isset($this->publishRequests[$msg->getRequestId()])) {
         /* @var $futureResult Deferred */
         $futureResult = $this->publishRequests[$msg->getRequestId()]["future_result"];
         $futureResult->reject($msg);
         unset($this->publishRequests[$msg->getRequestId()]);
     }
 }
Esempio n. 2
0
 /**
  * @param ClientSession $session
  * @param ErrorMessage $msg
  */
 public function processError(ClientSession $session, ErrorMessage $msg)
 {
     if (isset($this->publishRequests[$msg->getRequestId()])) {
         /* @var $futureResult Deferred */
         $futureResult = $this->publishRequests[$msg->getRequestId()]["future_result"];
         $futureResult->reject($msg->getErrorMsgCode());
         unset($this->publishRequests[$msg->getRequestId()]);
     }
 }
Esempio n. 3
0
 /**
  * Process ErrorMessage
  *
  * @param \Thruway\Message\ErrorMessage $msg
  */
 protected function processError(ErrorMessage $msg)
 {
     switch ($msg->getErrorMsgCode()) {
         case Message::MSG_CALL:
             if (isset($this->callRequests[$msg->getRequestId()])) {
                 /* @var $futureResult Deferred */
                 $futureResult = $this->callRequests[$msg->getRequestId()]['future_result'];
                 $futureResult->reject($msg);
                 unset($this->callRequests[$msg->getRequestId()]);
             }
             break;
     }
 }
Esempio n. 4
0
 /**
  * Handle error when unregister
  *
  * @param \Thruway\ClientSession $session
  * @param \Thruway\Message\ErrorMessage $msg
  */
 public function handleErrorUnregister(ClientSession $session, ErrorMessage $msg)
 {
     foreach ($this->registrations as $key => $registration) {
         if (isset($registration['unregister_request_id'])) {
             if ($registration["unregister_request_id"] === $msg->getRequestId()) {
                 /** @var Deferred $deferred */
                 $deferred = $registration['unregister_deferred'];
                 $deferred->reject($msg);
                 // I guess we get rid of the registration now?
                 unset($this->registrations[$key]);
                 break;
             }
         }
     }
 }
Esempio n. 5
0
 private function processInvocationError(Session $session, ErrorMessage $msg)
 {
     $call = $this->getCallByRequestId($msg->getRequestId());
     if (!$call) {
         $errorMsg = ErrorMessage::createErrorMessageFromMessage($msg);
         $this->manager->error('No call for invocation error message: ' . $msg->getRequestId());
         // TODO: do we send a message back to the callee?
         $errorMsg->setErrorURI('wamp.error.no_such_procedure');
         $session->sendMessage($errorMsg);
         return false;
     }
     $this->calls->detach($call);
     $errorMsg = ErrorMessage::createErrorMessageFromMessage($call->getCallMessage());
     $errorMsg->setErrorURI($msg->getErrorURI());
     $errorMsg->setArguments($msg->getArguments());
     $errorMsg->setArgumentsKw($msg->getArgumentsKw());
     $call->getCallerSession()->sendMessage($errorMsg);
 }
Esempio n. 6
0
 /**
  * @param Session $session
  * @param ErrorMessage $msg
  */
 private function processInterruptError(Session $session, ErrorMessage $msg)
 {
     $call = isset($this->callInterruptIndex[$msg->getRequestId()]) ? $this->callInterruptIndex[$msg->getRequestId()] : null;
     if (!$call) {
         Logger::warning($this, "Interrupt error with no corresponding interrupt index");
         return;
     }
     $errorMsgToCaller = ErrorMessage::createErrorMessageFromMessage($call->getCancelMessage());
     $errorMsgToCaller->setErrorURI($msg->getErrorURI());
     $callerSession = $call->getCallerSession();
     $callerSession->sendMessage($errorMsgToCaller);
     $call->getRegistration()->removeCall($call);
     $this->removeCall($call);
 }