mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-27 03:14:39 +01:00
Improve management of media DCs and HTTP errors
This commit is contained in:
parent
410af60201
commit
d2839070d8
@ -68,7 +68,6 @@ class DataCenter
|
||||
$ipv6 = $this->settings[$dc_config_number]['ipv6'] ? 'ipv6' : 'ipv4';
|
||||
if (!isset($this->dclist[$test][$ipv6][$dc_number]['ip_address'])) {
|
||||
unset($this->sockets[$dc_number]);
|
||||
|
||||
return false;
|
||||
}
|
||||
$address = $this->dclist[$test][$ipv6][$dc_number]['ip_address'];
|
||||
@ -83,7 +82,7 @@ class DataCenter
|
||||
$this->settings[$dc_config_number]['protocol'] = 'obfuscated2';
|
||||
}
|
||||
if (strpos($this->settings[$dc_config_number]['protocol'], 'https') === 0) {
|
||||
$subdomain = $this->dclist['ssl_subdomains'][$dc_number];
|
||||
$subdomain = $this->dclist['ssl_subdomains'][preg_replace('/\D+/', '', $dc_number)];
|
||||
$path = $this->settings[$dc_config_number]['test_mode'] ? 'apiw_test1' : 'apiw1';
|
||||
$address = 'https://'.$subdomain.'.web.telegram.org/'.$path;
|
||||
$port = 443;
|
||||
|
@ -165,7 +165,7 @@ trait CallHandler
|
||||
$only_updates = $this->handle_messages($aargs['datacenter']);
|
||||
// This method receives data from the socket, and parses stuff
|
||||
} catch (\danog\MadelineProto\Exception $e) {
|
||||
if ($e->getMessage() === 'I had to recreate the temporary authorization key') {
|
||||
if ($e->getMessage() === 'I had to recreate the temporary authorization key' || $e->getCode() === 404) {
|
||||
continue 2;
|
||||
}
|
||||
\danog\MadelineProto\Logger::log(['An error getting response of method '.$method.': '.$e->getMessage().' in '.basename($e->getFile(), '.php').' on line '.$e->getLine().'. Retrying...'], \danog\MadelineProto\Logger::WARNING);
|
||||
|
Loading…
Reference in New Issue
Block a user