mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 07:38:58 +01:00
Start IPC server immediately
This commit is contained in:
parent
7629e33f85
commit
0eb361cda5
2
docs
2
docs
@ -1 +1 @@
|
|||||||
Subproject commit 45b48bbb98e1d304e812b293327b4a951cf239e7
|
Subproject commit 3b96f262cb4399f0b6bfe775840cacac24bdab3b
|
30
src/API.php
30
src/API.php
@ -51,7 +51,7 @@ final class API extends AbstractAPI
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE = '8.2.3';
|
public const RELEASE = '8.2.4';
|
||||||
/**
|
/**
|
||||||
* We're not logged in.
|
* We're not logged in.
|
||||||
*
|
*
|
||||||
@ -220,6 +220,11 @@ final class API extends AbstractAPI
|
|||||||
$this->wrapper->logger('Prompting initial serialization...');
|
$this->wrapper->logger('Prompting initial serialization...');
|
||||||
$this->wrapper->serialize();
|
$this->wrapper->serialize();
|
||||||
$this->wrapper->logger('Done initial serialization!');
|
$this->wrapper->logger('Done initial serialization!');
|
||||||
|
$this->destruct();
|
||||||
|
if (!$this->connectToMadelineProto($settings)) {
|
||||||
|
throw new Exception("Could not start IPC server!");
|
||||||
|
}
|
||||||
|
|
||||||
$this->wrapper->logger(Lang::$current_lang['madelineproto_ready'], Logger::NOTICE);
|
$this->wrapper->logger(Lang::$current_lang['madelineproto_ready'], Logger::NOTICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,15 +371,9 @@ final class API extends AbstractAPI
|
|||||||
await(self::$destructors);
|
await(self::$destructors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Destruct function.
|
private function destruct(int|null $id = null): void
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
public function __destruct()
|
|
||||||
{
|
{
|
||||||
$id = \count(self::$destructors);
|
|
||||||
self::$destructors[$id] = async(function () use ($id): void {
|
|
||||||
$this->wrapper->logger('Shutting down MadelineProto ('.static::class.')');
|
$this->wrapper->logger('Shutting down MadelineProto ('.static::class.')');
|
||||||
$this->wrapper->getAPI()?->unreference();
|
$this->wrapper->getAPI()?->unreference();
|
||||||
if (isset($this->wrapper)) {
|
if (isset($this->wrapper)) {
|
||||||
@ -385,8 +384,19 @@ final class API extends AbstractAPI
|
|||||||
if ($this->unlock) {
|
if ($this->unlock) {
|
||||||
($this->unlock)();
|
($this->unlock)();
|
||||||
}
|
}
|
||||||
|
if ($id !== null) {
|
||||||
unset(self::$destructors[$id]);
|
unset(self::$destructors[$id]);
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Destruct function.
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
public function __destruct()
|
||||||
|
{
|
||||||
|
$id = \count(self::$destructors);
|
||||||
|
self::$destructors[$id] = async($this->destruct(...), $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user