1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 01:14:39 +01:00
This commit is contained in:
Daniil Gentili 2020-01-17 13:30:12 +00:00
parent 0d6f09565f
commit 235aab55e9
2 changed files with 6 additions and 6 deletions

2
docs

@ -1 +1 @@
Subproject commit de22c3b924011923438ce6e5e60725a51089ab04 Subproject commit 4ed3a8447cf21c69322bcdaf149eb3ce0befe8c0

View File

@ -444,15 +444,16 @@ trait Files
/** /**
* Constructor. * Constructor.
* *
* @param integer $size Total file size * @param integer $size Total file size
* @param integer $partSize Part size * @param integer $partSize Part size
* @param integer $cb Callback * @param callable $cb Callback
*/ */
public function __construct(int $size, int $partSize, $cb) public function __construct(int $size, int $partSize, callable $cb)
{ {
for ($x = 0; $x < $size; $x += $partSize) { for ($x = 0; $x < $size; $x += $partSize) {
$this->read []= new Deferred; $this->read []= new Deferred;
$this->write []= new Deferred; $this->write []= new Deferred;
$this->wrote []= $size - $x < $partSize ? $size - $x : $partSize;
} }
$this->partSize = $partSize; $this->partSize = $partSize;
$this->cb = $cb; $this->cb = $cb;
@ -482,7 +483,6 @@ trait Files
{ {
$offset /= $this->partSize; $offset /= $this->partSize;
$this->write[$offset]->resolve($data); $this->write[$offset]->resolve($data);
$this->wrote[$offset] = strlen($data);
return $this->read[$offset]->promise(); return $this->read[$offset]->promise();
} }
/** /**