Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2017-10-05 11:07:59 +00:00 committed by StyleCI Bot
parent d076eed6be
commit a52ff32169
5 changed files with 89 additions and 70 deletions

View File

@ -676,6 +676,7 @@ class MTProto
{
$this->initing_authorization = true;
$this->updates_state['sync_loading'] = true;
try {
foreach ($this->datacenter->sockets as $id => $socket) {
if (strpos($id, 'media')) {
@ -712,6 +713,7 @@ class MTProto
public function sync_authorization($authorized_dc)
{
$this->updates_state['sync_loading'] = true;
try {
foreach ($this->datacenter->sockets as $new_dc => $socket) {
if (($int_dc = preg_replace('|/D+|', '', $new_dc)) == $authorized_dc) {
@ -732,6 +734,7 @@ class MTProto
} finally {
$this->updates_state['sync_loading'] = false;
}
return $authorization;
}

View File

@ -501,6 +501,7 @@ trait AuthKeyHandler
public function get_dh_config()
{
$this->updates_state['sync_loading'] = true;
try {
$dh_config = $this->method_call('messages.getDhConfig', ['version' => $this->dh_config['version'], 'random_length' => 0], ['datacenter' => $this->datacenter->curdc]);
} finally {

View File

@ -83,6 +83,7 @@ trait CallHandler
if ($canunset = !$this->updates_state['sync_loading'] && !$this->threads && !$this->run_workers) {
$this->updates_state['sync_loading'] = true;
}
try {
\danog\MadelineProto\Logger::log(['Calling method (try number '.$count.' for '.$method.')...'], \danog\MadelineProto\Logger::ULTRA_VERBOSE);

View File

@ -193,11 +193,14 @@ trait UpdateHandler
break;
case 'updates.channelDifference':
$this->load_channel_state($channel)['sync_loading'] = true;
try {
$this->set_channel_state($channel, $difference);
$this->handle_update_messages($difference['new_messages'], $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']) {
unset($difference);
$this->get_channel_difference($channel);
@ -206,11 +209,14 @@ trait UpdateHandler
case 'updates.channelDifferenceTooLong':
\danog\MadelineProto\Logger::log(['Got '.$difference['_']], \danog\MadelineProto\Logger::VERBOSE);
$this->load_channel_state($channel)['sync_loading'] = true;
try {
$this->set_channel_state($channel, $difference);
$this->handle_update_messages($difference['messages'], $channel);
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);
break;
default:
@ -274,6 +280,7 @@ trait UpdateHandler
}
\danog\MadelineProto\Logger::log(['Got '.$difference['_']], \danog\MadelineProto\Logger::ULTRA_VERBOSE);
try {
switch ($difference['_']) {
case 'updates.differenceEmpty':
@ -302,17 +309,22 @@ trait UpdateHandler
throw new \danog\MadelineProto\Exception('Unrecognized update difference received: '.var_export($difference, true));
break;
}
} finally { $this->updates_state['sync_loading'] = false; }
} finally {
$this->updates_state['sync_loading'] = false;
}
}
public function get_updates_state()
{
$last = $this->updates_state['sync_loading'];
$this->updates_state['sync_loading'] = true;
try {
$data = $this->method_call('updates.getState', [], ['datacenter' => $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;
}

View File

@ -23,6 +23,7 @@ trait DialogHandler
$res = ['dialogs' => [0], 'count' => 1];
$datacenter = $this->datacenter->curdc;
$peers = [];
try {
while ($this->dialog_params['count'] < $res['count']) {
\danog\MadelineProto\Logger::log([\danog\MadelineProto\Lang::$current_lang['getting_dialogs']]);
@ -43,6 +44,7 @@ trait DialogHandler
} finally {
$this->updates_state['sync_loading'] = false;
}
return $peers;
}
}