mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 09:34:38 +01:00
CombinedAPI bugfixes
This commit is contained in:
parent
c993f4d207
commit
dee94bab3a
@ -186,7 +186,7 @@ class CombinedAPI
|
||||
if ($method === 'onLoop') {
|
||||
$this->loop_callback = [$this->event_handler_instance, 'onLoop'];
|
||||
} elseif ($method === 'onAny') {
|
||||
foreach (end($this->instances)->API->constructors->by_id as $id => $constructor) {
|
||||
foreach (end($this->instances)->API->constructors->by_id as $constructor) {
|
||||
if ($constructor['type'] === 'Update' && !isset($this->event_handler_methods[$constructor['predicate']])) {
|
||||
$this->event_handler_methods[$constructor['predicate']] = [$this->event_handler_instance, 'onAny'];
|
||||
}
|
||||
|
@ -35,8 +35,16 @@ abstract class CombinedEventHandler
|
||||
{
|
||||
$keys = method_exists($this, '__magic_sleep') ? $this->__magic_sleep() : get_object_vars($this);
|
||||
unset($keys['CombinedAPI']);
|
||||
foreach ($this->CombinedAPI->instance_paths as $path) {
|
||||
unset($keys[$path]);
|
||||
if (isset($this->CombinedAPI)) {
|
||||
foreach ($this->CombinedAPI->instance_paths as $path) {
|
||||
unset($keys[$path]);
|
||||
}
|
||||
} else {
|
||||
foreach ($keys as $key => $value) {
|
||||
if ($value instanceof API) {
|
||||
unset($keys[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_keys($keys);
|
||||
|
@ -105,7 +105,7 @@ class CheckLoop extends ResumableSignalLoop
|
||||
}
|
||||
}
|
||||
if ($reply) {
|
||||
$API->object_call('msg_resend_ans_req', ['msg_ids' => $reply], ['datacenter' => $datacenter, 'postpone' => true]);
|
||||
$API->object_call_async('msg_resend_ans_req', ['msg_ids' => $reply], ['datacenter' => $datacenter, 'postpone' => true]);
|
||||
}
|
||||
$connection->writer->resume();
|
||||
}
|
||||
|
@ -819,9 +819,6 @@ class MTProto implements TLCallback
|
||||
public function close_and_reopen($datacenter)
|
||||
{
|
||||
$this->wait($this->datacenter->sockets[$datacenter]->reconnect());
|
||||
/*if ($this->is_http($datacenter) && $this->datacenter->sockets[$datacenter]->temp_auth_key !== null && isset($this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited']) && $this->datacenter->sockets[$datacenter]->temp_auth_key['connection_inited'] === true) {
|
||||
$this->method_call('ping', ['ping_id' => 0], ['datacenter' => $datacenter]);
|
||||
}*/
|
||||
}
|
||||
|
||||
// Connects to all datacenters and if necessary creates authorization keys, binds them and writes client info
|
||||
|
@ -170,11 +170,6 @@ trait CallHandler
|
||||
return $deferred;
|
||||
}
|
||||
|
||||
public function object_call($object, $args = [], $aargs = ['msg_id' => null, 'heavy' => false])
|
||||
{
|
||||
return $this->wait($this->object_call_async($object, $args, $aargs));
|
||||
}
|
||||
|
||||
public function object_call_async($object, $args = [], $aargs = ['msg_id' => null, 'heavy' => false]): Promise
|
||||
{
|
||||
$message = ['_' => $object, 'body' => $args, 'content_related' => $this->content_related($object), 'unencrypted' => $this->datacenter->sockets[$aargs['datacenter']]->temp_auth_key === null, 'method' => false];
|
||||
|
Loading…
Reference in New Issue
Block a user