Esempio n. 1
0
 /**
  * [COROUTINE] Close this stream.
  *
  * Closing a stream indicates that no more data will be read from the
  * stream.
  */
 public function close()
 {
     if ($this->strand) {
         $this->strand->resumeWithException(new StreamClosedException());
         $this->strand = null;
     }
     $this->stream->close();
     $this->buffer = '';
     (yield Recoil::noop());
 }
Esempio n. 2
0
 /**
  * [COROUTINE] Close this channel.
  *
  * Closing a channel indicates that no more values will be read from or
  * written to the channel. Any future read/write operations will fail.
  */
 public function close()
 {
     $this->closed = true;
     while (!$this->writeStrands->isEmpty()) {
         $this->writeStrands->pop()->resumeWithException(new ChannelClosedException());
     }
     while (!$this->readStrands->isEmpty()) {
         $this->readStrands->pop()->resumeWithException(new ChannelClosedException());
     }
     (yield Recoil::noop());
 }
Esempio n. 3
0
 /**
  * [COROUTINE] Close this stream.
  *
  * Closing a stream indicates that no more data will be read from the
  * stream.
  */
 public function close()
 {
     if ($this->strand) {
         $this->strand->kernel()->eventLoop()->removeReadStream($this->stream);
         $this->strand->resumeWithException(new StreamClosedException());
         $this->strand = null;
     }
     if (is_resource($this->stream)) {
         fclose($this->stream);
     }
     (yield Recoil::noop());
 }