Improvements for update fetching on altervista
This commit is contained in:
parent
094fb38be3
commit
5a2e547c99
|
@ -61,29 +61,30 @@ trait UpdateHandler
|
||||||
$time = microtime(true);
|
$time = microtime(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
try {
|
if (!$this->is_http($this->datacenter->curdc) || $this->altervista) {
|
||||||
$waiting = $this->datacenter->select();
|
try {
|
||||||
$dc = count($waiting) ? $waiting[0] : $this->datacenter->curdc;
|
$waiting = $this->datacenter->select();
|
||||||
$last_recv = $this->datacenter->sockets[$dc]->last_recv;
|
$dc = count($waiting) ? $waiting[0] : $this->datacenter->curdc;
|
||||||
if (count($waiting) && !$this->is_http($dc)) {
|
$last_recv = $this->datacenter->sockets[$dc]->last_recv;
|
||||||
if (($error = $this->recv_message($dc)) !== true) {
|
if (count($waiting)) {
|
||||||
if ($error === -404) {
|
if (($error = $this->recv_message($dc)) !== true) {
|
||||||
if ($this->datacenter->sockets[$dc]->temp_auth_key !== null) {
|
if ($error === -404) {
|
||||||
\danog\MadelineProto\Logger::log('WARNING: Resetting auth key...', \danog\MadelineProto\Logger::WARNING);
|
if ($this->datacenter->sockets[$dc]->temp_auth_key !== null) {
|
||||||
$this->datacenter->sockets[$dc]->temp_auth_key = null;
|
\danog\MadelineProto\Logger::log('WARNING: Resetting auth key...', \danog\MadelineProto\Logger::WARNING);
|
||||||
$this->init_authorization();
|
$this->datacenter->sockets[$dc]->temp_auth_key = null;
|
||||||
|
$this->init_authorization();
|
||||||
|
|
||||||
throw new \danog\MadelineProto\Exception('I had to recreate the temporary authorization key');
|
throw new \danog\MadelineProto\Exception('I had to recreate the temporary authorization key');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
throw new \danog\MadelineProto\RPCErrorException($error, $error);
|
||||||
}
|
}
|
||||||
|
$only_updates = $this->handle_messages($dc);
|
||||||
throw new \danog\MadelineProto\RPCErrorException($error, $error);
|
|
||||||
}
|
}
|
||||||
$only_updates = $this->handle_messages($dc);
|
} catch (\danog\MadelineProto\NothingInTheSocketException $e) {
|
||||||
}
|
}
|
||||||
} catch (\danog\MadelineProto\NothingInTheSocketException $e) {
|
|
||||||
}
|
}
|
||||||
if ($this->is_http($dc) || time() - $this->last_getdifference > $this->settings['updates']['getdifference_interval']) {
|
if ($this->is_http($dc) || $this->altervista && time() - $this->last_getdifference > $this->settings['updates']['getdifference_interval']) {
|
||||||
$this->get_updates_difference();
|
$this->get_updates_difference();
|
||||||
}
|
}
|
||||||
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
} catch (\danog\MadelineProto\RPCErrorException $e) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user