Merge branch 'master' of https://github.com/danog/MadelineProto
This commit is contained in:
commit
27eb6c1a29
@ -157,7 +157,9 @@ class Connection
|
||||
case 'http':
|
||||
case 'https':
|
||||
$this->parsed = parse_url($ip);
|
||||
if ($this->parsed['host'][0] === '[') $this->parsed['host'] = substr($this->parsed['host'], 1, -1);
|
||||
if ($this->parsed['host'][0] === '[') {
|
||||
$this->parsed['host'] = substr($this->parsed['host'], 1, -1);
|
||||
}
|
||||
$this->sock = new $proxy($ipv6 ? \AF_INET6 : \AF_INET, \SOCK_STREAM, getprotobyname($this->protocol === 'https' ? 'tls' : 'tcp'));
|
||||
if ($has_proxy && $this->extra !== []) {
|
||||
$this->sock->setExtra($this->extra);
|
||||
|
@ -100,7 +100,9 @@ class DataCenter
|
||||
}
|
||||
|
||||
if ($this->settings[$dc_config_number]['protocol'] === 'http') {
|
||||
if ($ipv6) $address = '['.$address.']';
|
||||
if ($ipv6) {
|
||||
$address = '['.$address.']';
|
||||
}
|
||||
$address = $this->settings[$dc_config_number]['protocol'].'://'.$address.'/api';
|
||||
}
|
||||
\danog\MadelineProto\Logger::log([sprintf(\danog\MadelineProto\Lang::$current_lang['dc_con_test_start'], $dc_number, $test, $ipv6, $this->settings[$dc_config_number]['protocol'])], \danog\MadelineProto\Logger::VERBOSE);
|
||||
|
@ -630,11 +630,14 @@ class MTProto
|
||||
$socket->new_incoming = [];
|
||||
}
|
||||
}
|
||||
public function is_http($datacenter) {
|
||||
|
||||
public function is_http($datacenter)
|
||||
{
|
||||
return in_array($this->datacenter->sockets[$datacenter]->protocol, ['http', 'https']);
|
||||
}
|
||||
|
||||
public function close_and_reopen($datacenter) {
|
||||
public function close_and_reopen($datacenter)
|
||||
{
|
||||
$this->datacenter->sockets[$datacenter]->close_and_reopen();
|
||||
if ($this->is_http($datacenter)) {
|
||||
$this->method_call('http_wait', ['max_wait' => 0, 'wait_after' => 0, 'max_delay' => 0], ['datacenter' => $datacenter]);
|
||||
|
@ -553,7 +553,9 @@ trait AuthKeyHandler
|
||||
if ($res === true) {
|
||||
\danog\MadelineProto\Logger::log(['Successfully binded temporary and permanent authorization keys, DC '.$datacenter], \danog\MadelineProto\Logger::NOTICE);
|
||||
|
||||
if ($this->is_http($datacenter)) $this->close_and_reopen($datacenter);
|
||||
if ($this->is_http($datacenter)) {
|
||||
$this->close_and_reopen($datacenter);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user