This commit is contained in:
Daniil Gentili 2017-02-13 13:27:59 +01:00
parent 85b1345ad9
commit 4c3de2573d
3 changed files with 13 additions and 14 deletions

View File

@ -4,6 +4,6 @@ To contribute to this project simply fork it, make all improvements, commit chan
If you have an issue, please *always* upload MadelineProto logs from when the error occurred to hastebin or similar websites.
If you make breaking changes, make sure to increase the number returned by the getV function on line 54 of API.php.
If you make breaking changes, make sure to increase the number returned by the getV function in MTProto.php.
Bye :)

View File

@ -41,7 +41,7 @@ class API extends APIFactory
\danog\MadelineProto\Logger::log(['Pong: '.$pong['ping_id']], Logger::ULTRA_VERBOSE);
\danog\MadelineProto\Logger::log(['Getting future salts...'], Logger::ULTRA_VERBOSE);
$this->future_salts = $this->get_future_salts([3]);
$this->v = $this->getV();
$this->API->v = $this->API->getV();
\danog\MadelineProto\Logger::log(['MadelineProto is ready!'], Logger::NOTICE);
}
@ -49,24 +49,13 @@ class API extends APIFactory
{
//$this->API->reset_session(false);
return ['API', 'v'];
}
public function getV()
{
return 1;
return ['API'];
}
public function __wakeup()
{
set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']);
$this->APIFactory();
$this->API->setup_logger();
if (!isset($this->v) || $this->v !== $this->getV()) {
\danog\MadelineProto\Logger::log(['Serialization is out of date, reconstructing object!'], Logger::WARNING);
$this->API->__construct($this->API->settings);
$this->v = $this->getV();
}
}
public function __destruct()

View File

@ -63,6 +63,11 @@ class MTProto extends PrimeModule
public function __wakeup()
{
$this->setup_logger();
if (!isset($this->v) || $this->v !== $this->getV()) {
\danog\MadelineProto\Logger::log(['Serialization is out of date, reconstructing object!'], Logger::WARNING);
$this->__construct($this->settings);
$this->v = $this->getV();
}
$this->datacenter->__construct($this->settings['connection'], $this->settings['connection_settings']);
$this->reset_session();
if ($this->datacenter->authorized && $this->settings['updates']['handle_updates']) {
@ -355,4 +360,9 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
$this->settings['connection'][$test][$ipv6][$id] = $dc;
}
}
public function getV()
{
return 1;
}
}