Do not rely on old data

This commit is contained in:
Daniil Gentili 2019-12-28 23:53:10 +01:00
parent f64efb021c
commit e600f91975
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
2 changed files with 2 additions and 2 deletions

View File

@ -272,7 +272,7 @@ class DataCenter
}
foreach ($ctxs as $ctx) {
try {
if ($old) {
if ($old && $this->sockets[$dc_number]->hasConnection($id)) {
$this->API->logger->logger("Reconnecting to DC $dc_number ($id) from existing", \danog\MadelineProto\Logger::WARNING);
$this->sockets[$dc_number]->setExtra($this->API);
yield $this->sockets[$dc_number]->connect($ctx, $id);

View File

@ -136,7 +136,7 @@ class Logger
$settings['logger']['logger_param'] = Magic::$script_cwd.'/MadelineProto.log';
}
$logger = new self($settings['logger']['logger'], isset($settings['logger']['logger_param']) ? $settings['logger']['logger_param'] : '', $prefix, isset($settings['logger']['logger_level']) ? $settings['logger']['logger_level'] : Logger::VERBOSE, isset($settings['logger']['max_size']) ? $settings['logger']['max_size'] : 100 * 1024 * 1024);
$logger = new self($settings['logger']['logger'], $settings['logger']['logger_param'] ?? '', $prefix, $settings['logger']['logger_level'] ?? Logger::VERBOSE, $settings['logger']['max_size'] ?? 100 * 1024 * 1024);
if (!self::$default) {
self::$default = $logger;
}