Improve fileCallback

This commit is contained in:
Daniil Gentili 2020-01-18 16:11:40 +01:00
parent 235aab55e9
commit 3939e113f5
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 5 additions and 5 deletions

2
docs

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

View File

@ -1205,7 +1205,7 @@ trait Files
} }
if ($offset === $end) { if ($offset === $end) {
$cb(100); $cb(100, 0, 0);
return true; return true;
} }
$params = []; $params = [];
@ -1235,7 +1235,7 @@ trait Files
} }
if (!$params) { if (!$params) {
$cb(100); $cb(100, 0, 0);
return true; return true;
} }
$count = \count($params); $count = \count($params);
@ -1256,7 +1256,7 @@ trait Files
$start = \microtime(true); $start = \microtime(true);
$size = yield $this->downloadPart($message_media, $cdn, $datacenter, $old_dc, $ige, $cb, $initParam = \array_shift($params), $callable, $seekable); $size = yield $this->downloadPart($message_media, $cdn, $datacenter, $old_dc, $ige, $cb, $initParam = \array_shift($params), $callable, $seekable);
if ($initParam['part_end_at'] - $initParam['part_start_at'] !== $size) { // Premature end for undefined length files if ($initParam['part_end_at'] - $initParam['part_start_at'] !== $size) { // Premature end for undefined length files
$origCb(100); $origCb(100, 0, 0);
return true; return true;
} }
@ -1304,7 +1304,7 @@ trait Files
} }
if (!isset($message_media['size'])) { if (!isset($message_media['size'])) {
$origCb(100); $origCb(100, 0, 0);
} }
return true; return true;