cancel() public method

public cancel ( Throwable $reason = null )
$reason Throwable
コード例 #1
0
ファイル: Emitter.php プロジェクト: mrxotey/icicle
 /**
  * {@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);
     }
 }
コード例 #2
0
 /**
  * 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());
     }
 }