close_and_reopen bugfix

This commit is contained in:
Daniil Gentili 2018-12-28 17:21:04 +01:00
parent 16087b4863
commit 08313ece9c
5 changed files with 10 additions and 6 deletions

View File

@ -158,8 +158,8 @@ class API extends APIFactory
if (Magic::is_fork() && !Magic::$processed_fork) {
\danog\MadelineProto\Logger::log('Detected fork');
$this->API->reset_session();
foreach ($this->API->datacenter->sockets as $datacenter) {
$datacenter->close_and_reopen();
foreach ($this->API->datacenter->sockets as $id => $datacenter) {
$this->API->close_and_reopen($id);
}
Magic::$processed_fork = true;
}

View File

@ -133,8 +133,8 @@ class APIFactory
if (Magic::is_fork() && !Magic::$processed_fork) {
\danog\MadelineProto\Logger::log('Detected fork');
$this->API->reset_session();
foreach ($this->API->datacenter->sockets as $datacenter) {
$datacenter->close_and_reopen();
foreach ($this->API->datacenter->sockets as $id => $datacenter) {
$this->API->close_and_reopen($id);
}
Magic::$processed_fork = true;
}

View File

@ -49,8 +49,8 @@ class EventHandler extends APIFactory
if (Magic::is_fork() && !Magic::$processed_fork) {
\danog\MadelineProto\Logger::log('Detected fork');
$this->API->reset_session();
foreach ($this->API->datacenter->sockets as $datacenter) {
$datacenter->close_and_reopen();
foreach ($this->API->datacenter->sockets as $id => $datacenter) {
$this->API->close_and_reopen($id);
}
Magic::$processed_fork = true;
}

View File

@ -772,6 +772,8 @@ trait PeerHandler
$offset += count($gres['participants']);
} while (count($gres['participants']));
if ($offset === $limit) return true;
return $has_more;
}

View File

@ -67,6 +67,8 @@ if ($MadelineProto->get_self() === false) {
}
}
var_dump(count($MadelineProto->get_pwr_chat('@madelineproto')['participants']));
/*
* Test logging
*/