mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-22 17:51:19 +01:00
Bugfixes
This commit is contained in:
parent
b0d512b77d
commit
fe8e795f8a
2
docs
2
docs
@ -1 +1 @@
|
||||
Subproject commit 648b0a1250e3949c631421b8f1666371567f74c7
|
||||
Subproject commit a17ccba895f5e980947264f929611e157aa7c35c
|
@ -24,7 +24,6 @@ use danog\MadelineProto\EventHandler;
|
||||
use danog\MadelineProto\Exception;
|
||||
use danog\MadelineProto\Logger;
|
||||
use danog\MadelineProto\RPCErrorException;
|
||||
use danog\MadelineProto\Tools;
|
||||
|
||||
/*
|
||||
* Various ways to load MadelineProto
|
||||
@ -106,4 +105,4 @@ foreach ([
|
||||
$MadelineProtos []= new API($session);
|
||||
}
|
||||
|
||||
API::startAndLoopMulti($MadelineProtos, MyEventHandler::class);
|
||||
API::startAndLoopMulti($MadelineProtos, MyEventHandler::class);
|
||||
|
@ -18,7 +18,7 @@
|
||||
* @link https://docs.madelineproto.xyz MadelineProto documentation
|
||||
*/
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
require '../vendor/autoload.php';
|
||||
|
||||
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
|
||||
$me = $MadelineProto->start();
|
||||
|
@ -139,6 +139,7 @@ class API extends InternalDoc
|
||||
if (isset($this->API)) {
|
||||
$this->storage = $this->API->storage ?? $this->storage;
|
||||
|
||||
$unserialized->oldInstance = true;
|
||||
unset($unserialized);
|
||||
|
||||
yield from $this->API->initAsynchronously();
|
||||
@ -172,7 +173,7 @@ class API extends InternalDoc
|
||||
{
|
||||
$this->init();
|
||||
if (!$this->oldInstance) {
|
||||
$this->logger('Shutting down MadelineProto (API)');
|
||||
$this->logger->logger('Shutting down MadelineProto (API)');
|
||||
if ($this->API) {
|
||||
$this->API->destructing = true;
|
||||
}
|
||||
@ -180,18 +181,9 @@ class API extends InternalDoc
|
||||
Tools::wait($this->wrapper->serialize(), true);
|
||||
$this->API->unreference();
|
||||
} else {
|
||||
$this->logger('Shutting down MadelineProto (old deserialized instance of API)');
|
||||
$this->logger->logger('Shutting down MadelineProto (old deserialized instance of API)');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Wakeup function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __wakeup(): void
|
||||
{
|
||||
$this->oldInstance = true;
|
||||
}
|
||||
/**
|
||||
* Init API wrapper.
|
||||
*
|
||||
@ -230,7 +222,7 @@ class API extends InternalDoc
|
||||
Tools::wait($this->startAndLoopAsync($eventHandler));
|
||||
return;
|
||||
} catch (\Throwable $e) {
|
||||
$this->logger((string) $e, Logger::FATAL_ERROR);
|
||||
$this->logger->logger((string) $e, Logger::FATAL_ERROR);
|
||||
$this->report("Surfaced: $e");
|
||||
}
|
||||
}
|
||||
@ -249,7 +241,7 @@ class API extends InternalDoc
|
||||
$eventHandler = \array_fill_keys(\array_keys($instances), $eventHandler);
|
||||
}
|
||||
|
||||
$instanceOne = array_values($instances)[0];
|
||||
$instanceOne = \array_values($instances)[0];
|
||||
while (true) {
|
||||
try {
|
||||
$promises = [];
|
||||
@ -283,7 +275,7 @@ class API extends InternalDoc
|
||||
yield $this->setEventHandler($eventHandler);
|
||||
return yield from $this->API->loop();
|
||||
} catch (\Throwable $e) {
|
||||
$this->logger((string) $e, Logger::FATAL_ERROR);
|
||||
$this->logger->logger((string) $e, Logger::FATAL_ERROR);
|
||||
$this->report("Surfaced: $e");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user