bugfixes
This commit is contained in:
parent
1858b7f8c8
commit
56ae262738
@ -34,8 +34,8 @@ class DataCenter extends \Volatile
|
||||
{
|
||||
$this->dclist = $dclist;
|
||||
$this->settings = $settings;
|
||||
foreach ($this->sockets as $socket) {
|
||||
$socket->close_and_reopen();
|
||||
foreach ($this->sockets as $key => $socket) {
|
||||
if ($socket instanceof Connection) $socket->close_and_reopen(); else unset($this->sockets[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -237,6 +237,7 @@ class MTProto extends \Volatile
|
||||
$this->datacenter->curdc = 2;
|
||||
|
||||
if (!isset($this->authorization['user']['bot']) || !$this->authorization['user']['bot']) {
|
||||
try {
|
||||
$nearest_dc = $this->method_call('help.getNearestDc', [], ['datacenter' => $this->datacenter->curdc]);
|
||||
\danog\MadelineProto\Logger::log(["We're in ".$nearest_dc['country'].', current dc is '.$nearest_dc['this_dc'].', nearest dc is '.$nearest_dc['nearest_dc'].'.'], Logger::NOTICE);
|
||||
|
||||
@ -245,6 +246,9 @@ class MTProto extends \Volatile
|
||||
$this->settings['connection_settings']['default_dc'] = $nearest_dc['nearest_dc'];
|
||||
$this->should_serialize = true;
|
||||
}
|
||||
} catch (RPCErrorException $e) {
|
||||
if ($e->rpc !== "BOT_METHOD_INVALID") throw $e;
|
||||
}
|
||||
}
|
||||
$this->get_config([], ['datacenter' => $this->datacenter->curdc]);
|
||||
$this->v = $this->getV();
|
||||
|
Loading…
Reference in New Issue
Block a user