Fix shutdown loop, automatically inflate stripped photoSizes, improve composer reporter
This commit is contained in:
parent
58e0985d33
commit
bfd08f5744
|
@ -52,7 +52,8 @@
|
|||
"danog/7to70": "^1",
|
||||
"danog/7to5": "^1",
|
||||
"vimeo/psalm": "dev-master",
|
||||
"phpstan/phpstan": "^0.12.14"
|
||||
"phpstan/phpstan": "^0.12.14",
|
||||
"friendsofphp/php-cs-fixer": "^2.16"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-libtgvoip": "Install the php-libtgvoip extension to make phone calls (https://github.com/danog/php-libtgvoip)"
|
||||
|
|
|
@ -84,6 +84,7 @@ class MyEventHandler extends EventHandler
|
|||
if (isset($update['message']['media']) && $update['message']['media']['_'] !== 'messageMediaGame') {
|
||||
yield $this->messages->sendMedia(['peer' => $update, 'message' => $update['message']['message'], 'media' => $update]);
|
||||
}
|
||||
yield $this->ping(['multiple' => true] + \array_map(fn ($v) => ['ping_id' => $v], \range(0, 1020)));
|
||||
}
|
||||
}
|
||||
$settings = [
|
||||
|
|
|
@ -184,7 +184,7 @@ class API extends InternalDoc
|
|||
$this->API->unreference();
|
||||
}
|
||||
$this->destructing = true;
|
||||
Tools::wait($this->wrapper->serialize(), true);
|
||||
Tools::wait($this->wrapper->serialize());
|
||||
} else {
|
||||
$this->logger->logger('Shutting down MadelineProto (old deserialized instance of API)');
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ class DocsBuilder
|
|||
foreach (['string', 'bytes', 'int', 'int53', 'long', 'int128', 'int256', 'int512', 'double', 'Bool', 'DataJSON'] as $type) {
|
||||
\file_put_contents("types/$type.md", $this->templates[$type]);
|
||||
}
|
||||
foreach (['boolFalse', 'boolTrue', 'null'] as $constructor) {
|
||||
foreach (['boolFalse', 'boolTrue', 'null', 'photoStrippedSize'] as $constructor) {
|
||||
\file_put_contents("constructors/$constructor.md", $this->templates[$constructor]);
|
||||
}
|
||||
\danog\MadelineProto\Logger::log('Done!', \danog\MadelineProto\Logger::NOTICE);
|
||||
|
|
|
@ -72,12 +72,16 @@ class CheckLoop extends ResumableSignalLoop
|
|||
return;
|
||||
}
|
||||
}
|
||||
if ($connection->hasPendingCalls()) {
|
||||
if (!$connection->hasPendingCalls()) {
|
||||
if (yield $this->waitSignal($this->pause($timeout))) {
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$last_msgid = $connection->msgIdHandler->getMaxId(true);
|
||||
$last_chunk = $connection->getLastChunk();
|
||||
if ($shared->hasTempAuthKey()) {
|
||||
$full_message_ids = $connection->getPendingCalls();
|
||||
//array_values($connection->new_outgoing);
|
||||
foreach (\array_chunk($full_message_ids, 8192) as $message_ids) {
|
||||
$deferred = new Deferred();
|
||||
$deferred->promise()->onResolve(function ($e, $result) use ($message_ids, $API, $connection, $datacenter, $timeoutResend) {
|
||||
|
@ -163,11 +167,6 @@ class CheckLoop extends ResumableSignalLoop
|
|||
Tools::callForkDefer($connection->reconnect());
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (yield $this->waitSignal($this->pause($timeout))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public function __toString(): string
|
||||
|
|
|
@ -223,7 +223,6 @@ class ReadLoop extends SignalLoop
|
|||
$connection->incoming_messages[$message_id]['content'] = $deserialized;
|
||||
$connection->incoming_messages[$message_id]['response'] = -1;
|
||||
$connection->new_incoming[$message_id] = $message_id;
|
||||
//$connection->last_http_wait = 0;
|
||||
$API->logger->logger('Received payload from DC '.$datacenter, Logger::ULTRA_VERBOSE);
|
||||
} finally {
|
||||
$connection->reading(false);
|
||||
|
|
|
@ -1870,7 +1870,11 @@ class MTProto extends AsyncConstruct implements TLCallback
|
|||
*/
|
||||
public function getConstructorCallbacks(): array
|
||||
{
|
||||
return \array_merge(\array_fill_keys(['chat', 'chatEmpty', 'chatForbidden', 'channel', 'channelEmpty', 'channelForbidden'], [[$this, 'addChat']]), \array_fill_keys(['user', 'userEmpty'], [[$this, 'addUser']]), ['help.support' => [[$this, 'addSupport']]]);
|
||||
return \array_merge(
|
||||
\array_fill_keys(['chat', 'chatEmpty', 'chatForbidden', 'channel', 'channelEmpty', 'channelForbidden'], [[$this, 'addChat']]),
|
||||
\array_fill_keys(['user', 'userEmpty'], [[$this, 'addUser']]),
|
||||
['help.support' => [[$this, 'addSupport']]]
|
||||
);
|
||||
}
|
||||
/**
|
||||
* Called right before deserialization of object.
|
||||
|
|
|
@ -82,6 +82,18 @@ abstract class Session
|
|||
* @var array
|
||||
*/
|
||||
public $ack_queue = [];
|
||||
/**
|
||||
* State request queue.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $state_queue = [];
|
||||
/**
|
||||
* Resend request queue.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $resend_queue = [];
|
||||
/**
|
||||
* Message ID handler.
|
||||
*
|
||||
|
|
|
@ -995,6 +995,8 @@ class TL
|
|||
default:
|
||||
return $x['value'];
|
||||
}
|
||||
} elseif ($x['_'] === 'photoStrippedSize') {
|
||||
$x['inflated'] = Tools::inflateStripped($x['bytes']);
|
||||
}
|
||||
if (isset($this->callbacks[TLCallback::CONSTRUCTOR_CALLBACK][$x['_']])) {
|
||||
foreach ($this->callbacks[TLCallback::CONSTRUCTOR_CALLBACK][$x['_']] as $callback) {
|
||||
|
|
|
@ -116,7 +116,7 @@ function ___install_madeline()
|
|||
];
|
||||
}
|
||||
|
||||
if (defined('HHVM_VERSION')) {
|
||||
if (\defined('HHVM_VERSION')) {
|
||||
$phpVersion = 'HHVM ' . HHVM_VERSION;
|
||||
} else {
|
||||
$phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
|
||||
|
@ -126,14 +126,14 @@ function ___install_madeline()
|
|||
'method' => 'POST',
|
||||
'header' => [
|
||||
'Content-Type: application/json',
|
||||
sprintf(
|
||||
\sprintf(
|
||||
'User-Agent: Composer/%s (%s; %s; %s; %s%s)',
|
||||
'MadelineProto',
|
||||
function_exists('php_uname') ? @php_uname('s') : 'Unknown',
|
||||
function_exists('php_uname') ? @php_uname('r') : 'Unknown',
|
||||
\function_exists('php_uname') ? @\php_uname('s') : 'Unknown',
|
||||
\function_exists('php_uname') ? @\php_uname('r') : 'Unknown',
|
||||
$phpVersion,
|
||||
'streams',
|
||||
getenv('CI') ? '; CI' : ''
|
||||
\getenv('CI') ? '; CI' : ''
|
||||
)
|
||||
],
|
||||
'content' => \json_encode($postData),
|
||||
|
|
Loading…
Reference in New Issue