Add speed and time to progress callbacks

This commit is contained in:
Daniil Gentili 2019-12-29 15:12:45 +01:00
parent 0596231704
commit 203d86cb28
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 9 additions and 5 deletions

2
docs

@ -1 +1 @@
Subproject commit 087d105504aedc9eda89660f8cbc3842f116f573
Subproject commit 135f3110232f3a486b83438fdc0f15db165f7494

View File

@ -277,10 +277,12 @@ trait Files
$ctx = \hash_init('md5');
$promises = [];
$cb = function () use ($cb, $part_total_num) {
$speed = 0;
$time = 0;
$cb = function () use ($cb, $part_total_num, &$speed, &$time) {
static $cur = 0;
$cur++;
\danog\MadelineProto\Tools::callFork($cb($cur * 100 / $part_total_num));
\danog\MadelineProto\Tools::callFork($cb($cur * 100 / $part_total_num, $speed, $time));
};
$start = \microtime(true);
@ -1155,10 +1157,12 @@ trait Files
}
$count = \count($params);
$cb = function () use ($cb, $count) {
$time = 0;
$speed = 0;
$cb = function () use ($cb, $count, &$time, &$speed) {
static $cur = 0;
$cur++;
\danog\MadelineProto\Tools::callFork($cb($cur * 100 / $count));
\danog\MadelineProto\Tools::callFork($cb($cur * 100 / $count, $time, $speed));
};
$cdn = false;