mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-23 06:51:23 +01:00
Improve cb
This commit is contained in:
parent
62dfaa0abe
commit
e46e707702
@ -321,6 +321,8 @@ trait ResponseHandler
|
|||||||
if (isset($request['promise']) && \is_object($request['promise'])) {
|
if (isset($request['promise']) && \is_object($request['promise'])) {
|
||||||
Loop::defer(function () use (&$request, $data) {
|
Loop::defer(function () use (&$request, $data) {
|
||||||
if (isset($request['promise'])) {
|
if (isset($request['promise'])) {
|
||||||
|
$this->logger->logger('Rejecting: '.(isset($request['_']) ? $request['_'] : '-'));
|
||||||
|
|
||||||
$promise = $request['promise'];
|
$promise = $request['promise'];
|
||||||
unset($request['promise']);
|
unset($request['promise']);
|
||||||
try {
|
try {
|
||||||
@ -521,7 +523,7 @@ trait ResponseHandler
|
|||||||
if (\is_numeric($seconds) && $seconds < $limit) {
|
if (\is_numeric($seconds) && $seconds < $limit) {
|
||||||
//$this->gotResponseForOutgoingMessageId($request_id);
|
//$this->gotResponseForOutgoingMessageId($request_id);
|
||||||
|
|
||||||
$this->logger->logger('Flood, waiting '.$seconds.' seconds before repeating async call...', \danog\MadelineProto\Logger::NOTICE);
|
$this->logger->logger('Flood, waiting '.$seconds.' seconds before repeating async call of '.($request['_'] ?? '').'...', \danog\MadelineProto\Logger::NOTICE);
|
||||||
$request['sent'] += $seconds;
|
$request['sent'] += $seconds;
|
||||||
Loop::delay($seconds * 1000, [$this, 'methodRecall'], ['message_id' => $request_id, ]);
|
Loop::delay($seconds * 1000, [$this, 'methodRecall'], ['message_id' => $request_id, ]);
|
||||||
|
|
||||||
|
@ -470,13 +470,15 @@ trait Files
|
|||||||
/**
|
/**
|
||||||
* Read callback, called when the chunk is read and fully resent.
|
* Read callback, called when the chunk is read and fully resent.
|
||||||
*
|
*
|
||||||
|
* @param mixed ...$params Params to be passed to cb
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function callback(): void
|
public function callback(...$params): void
|
||||||
{
|
{
|
||||||
$this->read[$this->offset++]->resolve();
|
$this->read[$this->offset++]->resolve();
|
||||||
if ($this->cb) {
|
if ($this->cb) {
|
||||||
Tools::callFork(($this->cb)());
|
Tools::callFork(($this->cb)(...$params));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user