Better connection management
This commit is contained in:
parent
f2b4eb3c00
commit
4f7c6c6936
@ -250,6 +250,7 @@ class Connection
|
|||||||
|
|
||||||
public function read($length)
|
public function read($length)
|
||||||
{
|
{
|
||||||
|
\danog\MadelineProto\Logger::log(["Asked to read $length"], \danog\MadelineProto\Logger::ULTRA_VERBOSE);
|
||||||
switch ($this->protocol) {
|
switch ($this->protocol) {
|
||||||
case 'obfuscated2':
|
case 'obfuscated2':
|
||||||
$packet = '';
|
$packet = '';
|
||||||
|
@ -69,7 +69,7 @@ class DataCenter
|
|||||||
if (!isset($this->dclist[$test][$ipv6][$dc_number]['ip_address'])) {
|
if (!isset($this->dclist[$test][$ipv6][$dc_number]['ip_address'])) {
|
||||||
unset($this->sockets[$dc_number]);
|
unset($this->sockets[$dc_number]);
|
||||||
|
|
||||||
return false;
|
throw new \danog\MadelineProto\Exception("No info for DC $dc_number");
|
||||||
}
|
}
|
||||||
$address = $this->dclist[$test][$ipv6][$dc_number]['ip_address'];
|
$address = $this->dclist[$test][$ipv6][$dc_number]['ip_address'];
|
||||||
$port = $this->dclist[$test][$ipv6][$dc_number]['port'];
|
$port = $this->dclist[$test][$ipv6][$dc_number]['port'];
|
||||||
@ -126,11 +126,11 @@ class DataCenter
|
|||||||
\danog\MadelineProto\Logger::log(['Connection failed, retrying connection without the proxy with '.($this->settings[$dc_config_number]['ipv6'] ? 'ipv6' : 'ipv4').'...'], \danog\MadelineProto\Logger::WARNING);
|
\danog\MadelineProto\Logger::log(['Connection failed, retrying connection without the proxy with '.($this->settings[$dc_config_number]['ipv6'] ? 'ipv6' : 'ipv4').'...'], \danog\MadelineProto\Logger::WARNING);
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
return false;
|
throw new \danog\MadelineProto\Exception("Could not connect to DC $dc_number");
|
||||||
}
|
}
|
||||||
} while (++$x);
|
} while (++$x);
|
||||||
|
|
||||||
return false;
|
throw new \danog\MadelineProto\Exception("Could not connect to DC $dc_number");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_dcs($all = true)
|
public function get_dcs($all = true)
|
||||||
|
Loading…
Reference in New Issue
Block a user