This commit is contained in:
Daniil Gentili 2019-06-24 20:14:28 +02:00
parent 83d9c2e1a0
commit 5f50fa4636
2 changed files with 7 additions and 3 deletions

View File

@ -187,7 +187,7 @@ class WriteLoop extends ResumableSignalLoop
$body_length = strlen($message['serialized_body']);
$actual_length = $body_length + 32;
if ($total_length && $total_length + $actual_length > 32760 || $count >= 1020) {
$API->logger->logger('Length overflow, postponing part of payload', \danog\MadelineProto\Logger::NOTICE);
$API->logger->logger('Length overflow, postponing part of payload', \danog\MadelineProto\Logger::ULTRA_VERBOSE);
break;
}
@ -248,7 +248,7 @@ class WriteLoop extends ResumableSignalLoop
$body_length = strlen($MTmessage['body']);
$actual_length = $body_length + 32;
if ($total_length && $total_length + $actual_length > 32760) {
$API->logger->logger('Length overflow, postponing part of payload', \danog\MadelineProto\Logger::NOTICE);
$API->logger->logger('Length overflow, postponing part of payload', \danog\MadelineProto\Logger::ULTRA_VERBOSE);
break;
}
$count++;

View File

@ -298,6 +298,7 @@ trait Files
private $done = [];
private $pending = [];
public $nextRead;
public $size;
public function write(string $data, int $offset)
{
if (isset($this->pending[$offset])) {
@ -325,11 +326,14 @@ trait Files
}
$this->pending[$offset] = new Deferred;
$res = $this->pending[$offset]->promise();
if ($offset + $size >= $this->size) {
$this->nextRead->resolve(true);
}
return $res;
}
};
$bridge->nextRead = new Deferred;
$bridge->size = $size;
$reader = [$bridge, 'read'];
$writer = [$bridge, 'write'];
yield $this->all([