mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-26 19:24:42 +01:00
Fix: timeout for outgoing messages & possible fatal error for media downloads
This commit is contained in:
parent
a2e77db9aa
commit
682e072a17
@ -98,7 +98,7 @@ trait AckHandler
|
||||
{
|
||||
$settings = $this->shared->getSettings();
|
||||
$global = $this->shared->getGenericSettings();
|
||||
$dropTimeout = $global->getRpc()->getRpcDropTimeout();
|
||||
$dropTimeout = (int)($global->getRpc()->getRpcDropTimeout() * 1_000_000_000.0);
|
||||
$timeout = (int) ($settings->getTimeout() * 1_000_000_000.0);
|
||||
$pfs = $global->getAuth()->getPfs();
|
||||
$unencrypted = !$this->shared->hasTempAuthKey();
|
||||
@ -122,6 +122,7 @@ trait AckHandler
|
||||
continue;
|
||||
}
|
||||
if ($message->getSent() + $dropTimeout < hrtime(true)) {
|
||||
Logger::log('No reply for message: ' . $message, Logger::WARNING);
|
||||
$this->handleReject($message, static fn () => new TimeoutException('Request timeout'));
|
||||
continue;
|
||||
}
|
||||
|
@ -1140,10 +1140,10 @@ trait Files
|
||||
foreach ($params as $key => $param) {
|
||||
$cancellation?->throwIfRequested();
|
||||
$param['previous_promise'] = $previous_promise;
|
||||
$previous_promise = async($this->downloadPart(...), $messageMedia, $cdn, $datacenter, $old_dc, $ige, $cb, $param, $callable, $seekable, $cancellation);
|
||||
$previous_promise = async($this->downloadPart(...), $messageMedia, $cdn, $datacenter, $old_dc, $ige, $cb, $param, $callable, $seekable, $cancellation)->ignore();
|
||||
$previous_promise->map(static function (int $res) use (&$size): void {
|
||||
$size += $res;
|
||||
});
|
||||
})->ignore();
|
||||
$promises[] = $previous_promise;
|
||||
if (\count($promises) === $parallel_chunks) {
|
||||
// 20 mb at a time, for a typical bandwidth of 1gbps
|
||||
|
Loading…
Reference in New Issue
Block a user