private function waitForStreamOnce($stream) : PromiseInterface { $deferred = new Deferred(); $this->loop->addWriteStream($stream, function ($stream) use($deferred) { $this->loop->removeWriteStream($stream); $deferred->resolve($stream); }); return $deferred->promise(); }
/** * @inheritdoc */ public function write($data) { if (!$this->writable) { return; } $this->data .= $data; if (false === $this->isListening()) { $this->setListening(true); $this->loop->addWriteStream($this->stream, [$this, 'handleWrite']); } $belowSoftLimit = strlen($this->data) < $this->getSoftLimit(); return $belowSoftLimit; }