From bd3bcb37671b2b96627776aaa79d9e54ef6b1f32 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 23 Dec 2017 02:35:15 +0100 Subject: [PATCH] bugfix --- src/danog/MadelineProto/MTProto.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index 87930a64..6b46623d 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -671,7 +671,21 @@ class MTProto if (!$cdn) { $this->bind_temp_auth_key($this->settings['authorization']['default_temp_auth_key_expires_in'], $id); $config = $this->write_client_info('help.getConfig', [], ['datacenter' => $id]); - + $this->sync_authorization($id); + $this->get_config($config); + } + if (in_array($socket->protocol, ['http', 'https'])) { + $this->method_call('http_wait', ['max_wait' => 0, 'wait_after' => 0, 'max_delay' => 0], ['datacenter' => $id]); + } + } else if (!$cdn) $this->sync_authorization($id); + } + } finally { + $this->initing_authorization = false; + $this->updates_state['sync_loading'] = false; + } + } + public function sync_authorization($id) { + $socket = $this->datacenter->sockets[$id]; if ($this->authorized === self::LOGGED_IN && $socket->authorized === false) { foreach ($this->datacenter->sockets as $authorized_dc_id => $authorized_socket) { if ($authorized_socket->authorized === true && $this->authorized === self::LOGGED_IN && $socket->authorized === false) { @@ -686,19 +700,7 @@ class MTProto } } } - $this->get_config($config); - } - if (in_array($socket->protocol, ['http', 'https'])) { - $this->method_call('http_wait', ['max_wait' => 0, 'wait_after' => 0, 'max_delay' => 0], ['datacenter' => $id]); - } - } - } - } finally { - $this->initing_authorization = false; - $this->updates_state['sync_loading'] = false; - } } - public function write_client_info($method, $arguments = [], $options = []) { \danog\MadelineProto\Logger::log([sprintf(\danog\MadelineProto\Lang::$current_lang['write_client_info'], $method)], Logger::NOTICE);