public function readFromBuffer(\EventBuffer $buf)
{
if (!$this->req) {
return false;
}
$n = min($this->req->attrs->contentLength - $this->readed, $buf->length);
if ($n > 0) {
$m = $this->appendFrom($buf, $n);
$this->readed += $m;
if ($m > 0) {
$this->onRead();
}
} else {
$this->onRead();
return 0;
}
return $m;
}