Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function flush() : Awaitable
 {
     if ($this->closed) {
         return new Failure(new StreamClosedException('Cannot flush closed stream'));
     }
     return new Coroutine(function () {
         try {
             $chunk = \deflate_add($this->context, $this->buffer, \ZLIB_FINISH);
         } finally {
             $this->buffer = '';
         }
         $len = $this->stream->write($chunk);
         (yield parent::flush());
         return $len;
     });
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function close() : Awaitable
 {
     $this->context = null;
     return parent::close();
 }