Apply fixes from StyleCI
This commit is contained in:
parent
d076eed6be
commit
a52ff32169
@ -676,6 +676,7 @@ class MTProto
|
|||||||
{
|
{
|
||||||
$this->initing_authorization = true;
|
$this->initing_authorization = true;
|
||||||
$this->updates_state['sync_loading'] = true;
|
$this->updates_state['sync_loading'] = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
foreach ($this->datacenter->sockets as $id => $socket) {
|
foreach ($this->datacenter->sockets as $id => $socket) {
|
||||||
if (strpos($id, 'media')) {
|
if (strpos($id, 'media')) {
|
||||||
@ -712,6 +713,7 @@ class MTProto
|
|||||||
public function sync_authorization($authorized_dc)
|
public function sync_authorization($authorized_dc)
|
||||||
{
|
{
|
||||||
$this->updates_state['sync_loading'] = true;
|
$this->updates_state['sync_loading'] = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
foreach ($this->datacenter->sockets as $new_dc => $socket) {
|
foreach ($this->datacenter->sockets as $new_dc => $socket) {
|
||||||
if (($int_dc = preg_replace('|/D+|', '', $new_dc)) == $authorized_dc) {
|
if (($int_dc = preg_replace('|/D+|', '', $new_dc)) == $authorized_dc) {
|
||||||
@ -732,6 +734,7 @@ class MTProto
|
|||||||
} finally {
|
} finally {
|
||||||
$this->updates_state['sync_loading'] = false;
|
$this->updates_state['sync_loading'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $authorization;
|
return $authorization;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,6 +501,7 @@ trait AuthKeyHandler
|
|||||||
public function get_dh_config()
|
public function get_dh_config()
|
||||||
{
|
{
|
||||||
$this->updates_state['sync_loading'] = true;
|
$this->updates_state['sync_loading'] = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$dh_config = $this->method_call('messages.getDhConfig', ['version' => $this->dh_config['version'], 'random_length' => 0], ['datacenter' => $this->datacenter->curdc]);
|
$dh_config = $this->method_call('messages.getDhConfig', ['version' => $this->dh_config['version'], 'random_length' => 0], ['datacenter' => $this->datacenter->curdc]);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -83,6 +83,7 @@ trait CallHandler
|
|||||||
if ($canunset = !$this->updates_state['sync_loading'] && !$this->threads && !$this->run_workers) {
|
if ($canunset = !$this->updates_state['sync_loading'] && !$this->threads && !$this->run_workers) {
|
||||||
$this->updates_state['sync_loading'] = true;
|
$this->updates_state['sync_loading'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
\danog\MadelineProto\Logger::log(['Calling method (try number '.$count.' for '.$method.')...'], \danog\MadelineProto\Logger::ULTRA_VERBOSE);
|
\danog\MadelineProto\Logger::log(['Calling method (try number '.$count.' for '.$method.')...'], \danog\MadelineProto\Logger::ULTRA_VERBOSE);
|
||||||
|
|
||||||
|
@ -193,11 +193,14 @@ trait UpdateHandler
|
|||||||
break;
|
break;
|
||||||
case 'updates.channelDifference':
|
case 'updates.channelDifference':
|
||||||
$this->load_channel_state($channel)['sync_loading'] = true;
|
$this->load_channel_state($channel)['sync_loading'] = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->set_channel_state($channel, $difference);
|
$this->set_channel_state($channel, $difference);
|
||||||
$this->handle_update_messages($difference['new_messages'], $channel);
|
$this->handle_update_messages($difference['new_messages'], $channel);
|
||||||
$this->handle_multiple_update($difference['other_updates'], [], $channel);
|
$this->handle_multiple_update($difference['other_updates'], [], $channel);
|
||||||
} finally { $this->load_channel_state($channel)['sync_loading'] = false; }
|
} finally {
|
||||||
|
$this->load_channel_state($channel)['sync_loading'] = false;
|
||||||
|
}
|
||||||
if (!$difference['final']) {
|
if (!$difference['final']) {
|
||||||
unset($difference);
|
unset($difference);
|
||||||
$this->get_channel_difference($channel);
|
$this->get_channel_difference($channel);
|
||||||
@ -206,11 +209,14 @@ trait UpdateHandler
|
|||||||
case 'updates.channelDifferenceTooLong':
|
case 'updates.channelDifferenceTooLong':
|
||||||
\danog\MadelineProto\Logger::log(['Got '.$difference['_']], \danog\MadelineProto\Logger::VERBOSE);
|
\danog\MadelineProto\Logger::log(['Got '.$difference['_']], \danog\MadelineProto\Logger::VERBOSE);
|
||||||
$this->load_channel_state($channel)['sync_loading'] = true;
|
$this->load_channel_state($channel)['sync_loading'] = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->set_channel_state($channel, $difference);
|
$this->set_channel_state($channel, $difference);
|
||||||
$this->handle_update_messages($difference['messages'], $channel);
|
$this->handle_update_messages($difference['messages'], $channel);
|
||||||
unset($difference);
|
unset($difference);
|
||||||
} finally { $this->load_channel_state($channel)['sync_loading'] = false; }
|
} finally {
|
||||||
|
$this->load_channel_state($channel)['sync_loading'] = false;
|
||||||
|
}
|
||||||
$this->get_channel_difference($channel);
|
$this->get_channel_difference($channel);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -274,6 +280,7 @@ trait UpdateHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
\danog\MadelineProto\Logger::log(['Got '.$difference['_']], \danog\MadelineProto\Logger::ULTRA_VERBOSE);
|
\danog\MadelineProto\Logger::log(['Got '.$difference['_']], \danog\MadelineProto\Logger::ULTRA_VERBOSE);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
switch ($difference['_']) {
|
switch ($difference['_']) {
|
||||||
case 'updates.differenceEmpty':
|
case 'updates.differenceEmpty':
|
||||||
@ -302,17 +309,22 @@ trait UpdateHandler
|
|||||||
throw new \danog\MadelineProto\Exception('Unrecognized update difference received: '.var_export($difference, true));
|
throw new \danog\MadelineProto\Exception('Unrecognized update difference received: '.var_export($difference, true));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} finally { $this->updates_state['sync_loading'] = false; }
|
} finally {
|
||||||
|
$this->updates_state['sync_loading'] = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_updates_state()
|
public function get_updates_state()
|
||||||
{
|
{
|
||||||
$last = $this->updates_state['sync_loading'];
|
$last = $this->updates_state['sync_loading'];
|
||||||
$this->updates_state['sync_loading'] = true;
|
$this->updates_state['sync_loading'] = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$data = $this->method_call('updates.getState', [], ['datacenter' => $this->datacenter->curdc]);
|
$data = $this->method_call('updates.getState', [], ['datacenter' => $this->datacenter->curdc]);
|
||||||
$this->get_cdn_config($this->datacenter->curdc);
|
$this->get_cdn_config($this->datacenter->curdc);
|
||||||
} finally { $this->updates_state['sync_loading'] = $last; }
|
} finally {
|
||||||
|
$this->updates_state['sync_loading'] = $last;
|
||||||
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ trait DialogHandler
|
|||||||
$res = ['dialogs' => [0], 'count' => 1];
|
$res = ['dialogs' => [0], 'count' => 1];
|
||||||
$datacenter = $this->datacenter->curdc;
|
$datacenter = $this->datacenter->curdc;
|
||||||
$peers = [];
|
$peers = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
while ($this->dialog_params['count'] < $res['count']) {
|
while ($this->dialog_params['count'] < $res['count']) {
|
||||||
\danog\MadelineProto\Logger::log([\danog\MadelineProto\Lang::$current_lang['getting_dialogs']]);
|
\danog\MadelineProto\Logger::log([\danog\MadelineProto\Lang::$current_lang['getting_dialogs']]);
|
||||||
@ -43,6 +44,7 @@ trait DialogHandler
|
|||||||
} finally {
|
} finally {
|
||||||
$this->updates_state['sync_loading'] = false;
|
$this->updates_state['sync_loading'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $peers;
|
return $peers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user