cancel() public method

public cancel ( Throwable $reason = null )
$reason Throwable
示例#1
0
 /**
  * {@inheritdoc}
  */
 public function dispose(Throwable $exception = null)
 {
     if (null === $exception) {
         $exception = new DisposedException('Observable disposed.');
     }
     $this->emitter = null;
     $this->queue->fail($exception);
     if (null !== $this->coroutine) {
         $this->coroutine->cancel($exception);
     }
 }
 /**
  * Processing loop
  */
 public function pump()
 {
     try {
         while ($this->isOpen()) {
             (yield $this->next());
         }
     } catch (\Exception $e) {
         if ($this->outputHeartbeatCoroutine) {
             $this->outputHeartbeatCoroutine->cancel();
             $this->outputHeartbeatCoroutine = null;
         }
         if ($this->inputHeartbeatCoroutine) {
             $this->inputHeartbeatCoroutine->cancel();
             $this->inputHeartbeatCoroutine = null;
         }
         (yield $this->client->close());
     }
 }